ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Jan.Mate...@rzf.fin-nrw.de>
Subject AW: Tstamp & co - setting a property with value = milliseconds since 1970
Date Thu, 30 Nov 2006 08:54:03 GMT
If you dont find a pattern on SimpleDateFormat [1], you could write a custom task

<scriptdef name="msec" language="javascript">
    <attribute name="property"/>
    <element name="fileset" type="fileset"/>
    <![CDATA[
        project.setNewProperty(attributes.get("property"), (new java.util.Date()).getTime()
);
    ]]>
</scriptdef>
<msec property="TIMESTAMP_MILLIS"/>


Jan


[1] http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html  

>-----Urspr√ľngliche Nachricht-----
>Von: Numain [mailto:numain@gmx.ch] 
>Gesendet: Mittwoch, 29. November 2006 22:06
>An: user@ant.apache.org
>Betreff: Tstamp & co - setting a property with value = 
>milliseconds since 1970
>
>Hi
>
>I've looked at the tstamp ant task, but it does not seem to 
>answer my need.
>
>I'd like to set a property with the milliseconds since 1970 
>(the long value of new Date().getTime()). The Millisecond 
>format does'nt help me since it only sets the millisecond 
>fraction of the current second.
>
>  <tstamp>
>    <format property="TIMESTAMP_MILLIS" pattern="SSSSSSSS" />
>  </tstamp>
>
>Is there an easy way to get this value in ant?
>
>Thanks!
>Numain
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For 
>additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message