ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <mail...@numerixtechnology.de>
Subject Re: AW: extract file date in a given format
Date Fri, 05 Jan 2007 16:42:36 GMT
Jan.Materne@rzf.fin-nrw.de wrote:
>>I tried to write a second script but am getting an 
>>IllegalArgumentException on "new Date(millis)":
>>
>><!-- usage : <formatdate millis="${millis}" format="yyMMddHHmm" 
>>property="formatted"/> -->
>><scriptdef name="filedate" language="javascript">
>>    <attribute name="millis"/>
>>    <attribute name="format"/>
>>    <attribute name="property"/>
>>    <![CDATA[
>>        millis = attributes.get("millis");
>>        format = attributes.get("format");
>>        propName = attributes.get("property");
>>        d = new java.util.Date(millis);
>>        f = new java.text.SimpleDateFormat(format);
>>	y = f.format(d);
>>        project.setNewProperty(propName, y);
>>    ]]>
>></scriptdef>
> 
> Project: public String getProperty(String propertyName)
> You have to convert the String into a long.

I tried :
   l = new java.lang.Long (millis);
   d = new java.util.Date(l);

This also results in a IllegalArgumentException when creating the Date.

>>Also: could I combine the two scripts and return 2 properties 
>>if format is specified?
> 
> You dont return a property - you store a value in project's
> property-hashtable.
> And of course you can save muliple values.

Thanks for the explanation. ;-)

-- 


Gruß aus Schottland,

Tarlika Elisabeth Schmitz

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


Mime
View raw message