Build.xml to set the date and time as the file name

I want to set a file name with a date and time attached to it, so I want to create a file called behat-20140913-195915.html , however the example below sets the name as behat-yyyymmdd-hhiiss.html . Does anyone know a solution to the problem?

I followed in this example

Note : these two do not work either: ${DSTAMP} ${TSTAMP}

 <?xml version="1.0" encoding="UTF-8"?> <project name="Sport" default="build-default" basedir="."> <tstamp> <format property="TODAY_MY" pattern="yyyymmdd-hhiiss" locale="en,UK" /> </tstamp> <target name="build" description="Runs everything in order ..." depends="behat-bdd" /> <target name="behat"> <echo msg="Running Behat tests ..." /> <exec logoutput="true" checkreturn="true" command="bin/behat -f progress --format html --out ${dir-report}/behat-${TODAY_MY}.html" dir="./" /> </target> </project> 
+5
source share
1 answer

The tstamp task is described in the ANT manual . It describes how the template format comes from the SimpleDateFormat object:

I suggest trying the following:

Example

 Buildfile: build.xml build: [echo] date: 20140913-203419 

build.xml

 <project name="demo" default="build"> <tstamp> <format property="TODAY_MY" pattern="yyyyMMdd-HHmmss" locale="en,UK" /> </tstamp> <target name="build"> <echo message="date: ${TODAY_MY}"/> </target> </project> 

Software version

 $ ant -v Apache Ant(TM) version 1.9.4 compiled on April 29 2014 $ java -version java version "1.7.0_25" Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) 
+9
source

Source: https://habr.com/ru/post/1202504/


All Articles