Ant includes a Tstamp task that allows a property to be set to the current date and time in a given format. Unfortunately there is no way to get that value as a Unix time (epoch).
Here's how you can do this with the help of some Javascript:
<target name="print-epoch">
<script language="javascript">
<![CDATA[
property = project.setProperty("now",Math.floor((new Date()).getTime()/1000));
]]>
</script>
<echo message="${now}" />
</target>
Check the documentation of the script task for more information about scripts and their dependencies in Ant.

Add new comment