Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
AW: Any date format task?

AW: Any date format task?

2003-03-12       - By Jan.Materne@(protected)

AFAIK there is nothing "Date"-specific. But you can use the optional task
<replaceregexp>.


<replaceregexp
   file="aFileWithMyTimestamp"

match="tstamp.old=([1-2][0-9][0-9][0-9])([0-1]?[0-9]?)([0-3]?[0-9]?)([0-2]?[
0-9]?)([0-5]?[0-9]?)([0-5]?[0-9]?)"
   replace="tstamp.new=\1.\2.\3.\4:\5:\6"
   byline="true"
/>

Testdata:
tstamp.old=20030312075500
tstamp.old=200303120755
tstamp.old=2003031207
tstamp.old=20030312
tstamp.old=200303
tstamp.old=2003

Testresult:
tstamp.new=2003.03.12.07:55:00
tstamp.new=2003.03.12.07:55:
tstamp.new=2003.03.12.07::
tstamp.new=2003.03.12.::
tstamp.new=2003.03..::
tstamp.new=2003...::


Jan Mat?rne


-----Urspr?ngliche Nachricht-----
Von: Woo, Chen Ching [mailto:cwoo@(protected)]
Gesendet am: Dienstag, 11. M?rz 2003 21:29
An: Ant Users List
Betreff: RE: Any date format task?

The <timestamp> seemed to use the current time, but I've a timestamp value
available through a property. In other words, it would be nice if I could
use the <format> task with an input timestamp string to format.

-----Original Message-----
From: M. Erik Husby [mailto:mhusby@(protected)]
Sent: Tuesday, March 11, 2003 2:23 PM
To: Ant Users List
Subject: Re: Any date format task?


Read the documentation on the TSTAMP task. It can do what you ask.

Woo, Chen Ching wrote:

>Is there a task available to format a timestamp from the format of
yyyymmddhhmmss to something else, say yyyy.mm.dd.hh:mm:ss ?
>Thanks
>
>chen.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@(protected)
>For additional commands, e-mail: user-help@(protected)
>
>  
>

--
Erik Husby
Team Lead for Software Quality Automation
Whitehead Institute/MIT Center for Genome Research
320 Charles St
Cambridge, MA 02141-2023
mobile: 781.354.6669
office: 617.258.9227
mhusby@(protected)




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.