Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 76823 invoked from network); 5 Jan 2007 07:38:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2007 07:38:08 -0000 Received: (qmail 48984 invoked by uid 500); 5 Jan 2007 07:38:11 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 48954 invoked by uid 500); 5 Jan 2007 07:38:11 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 48943 invoked by uid 99); 5 Jan 2007 07:38:11 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2007 23:38:11 -0800 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [193.109.238.66] (HELO dnsinet.rzf-nrw.de) (193.109.238.66) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jan 2007 23:38:01 -0800 Received: from z011100.bk.fin.local (z011104.bk.fin.local [172.18.101.140]) by dnsinet.rzf-nrw.de (8.13.8/8.13.8) with ESMTP id l057bbaG029637; Fri, 5 Jan 2007 08:37:37 +0100 Received: from z011134.bk.fin.local ([130.11.7.134]) by z011100.bk.fin.local with Microsoft SMTPSVC(6.0.3790.0); Fri, 5 Jan 2007 08:37:38 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: AW: extract file date in a given format Date: Fri, 5 Jan 2007 08:37:38 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: extract file date in a given format Thread-Index: AccwURPb1TP8DcFSRtqzqaNWRqCV4AASuFkg From: To: , X-OriginalArrivalTime: 05 Jan 2007 07:37:38.0179 (UTC) FILETIME=[5FB09D30:01C7309C] X-Virus-Checked: Checked by ClamAV on apache.org >=20 > > > > fileName =3D attributes.get("file"); > propName =3D attributes.get("property"); > file =3D new java.io.File(fileName); > last =3D file.lastModified(); > project.setNewProperty(propName, last); > ]]> > >I also need the date in a human readable format. > >I tried to write a second script but am getting an=20 >IllegalArgumentException on "new Date(millis)": > > > > > > > millis =3D attributes.get("millis"); > format =3D attributes.get("format"); > propName =3D attributes.get("property"); > d =3D new java.util.Date(millis); > f =3D new java.text.SimpleDateFormat(format); > y =3D f.format(d); > project.setNewProperty(propName, y); > ]]> > Project: public String getProperty(String propertyName) You have to convert the String into a long. >Also: could I combine the two scripts and return 2 properties=20 >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. Jan --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org