You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ravi Roy <ra...@gmail.com> on 2008/04/26 10:05:17 UTC

How to store date time as a long value into a text file.

Hi all,

I have searched the archives, but I am not able to get the answer of
my question. My problem is I want to create a file say "foo" and store
current time as long value in that using Ant.

For example :

long myvar = System.currentTimeMillis();

would produce a long value of current date time, which I want to store in "foo"

I created the file :

	<target name="create.foo">
  	     <touch file="foo" />
  	</target>

But I am not sure, I to store date time as long value into that file..
Does some have any idea ?

Regards,
Ravi.

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


Re: How to store date time as a long value into a text file.

Posted by "Scot P. Floess" <fl...@mindspring.com>.
There is a millisecond pattern:  "S"

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

<tstamp>
    <format property="some-property pattern="S"/>
</tstamp>


Ravi Roy wrote:
> Sorry for dely in replying... I tried tstamp ant task, but it gives me the
> date and time in the format I specify in pattern, while I wanted a long
> value produced by  System.currentTimeMillis() in the created file.
>
> Thanks for your response.
> Regards
> Ravi.
>
> -----Original Message-----
> From: Scot P. Floess [mailto:floess@mindspring.com] 
> Sent: Sunday, April 27, 2008 7:33 PM
> To: Ant Users List
> Subject: Re: How to store date time as a long value into a text file.
>
>
> Did you look at the tstamp task?
>
>             <tstamp>
>                 <format  property = "some-property"  pattern = 
> "yyyy-MM-dd_HH-mm-ss"/>
>             </tstamp>
>
> Ravi Roy wrote:
>   
>> Just to inform the list, I was not able to wokout this problem using 
>> standard Ant task, I had to write small custom Ant task to solve this 
>> problem -- which in fact I was trying to avoid ;-)
>>
>> Regards,
>> Ravi.
>>
>>
>> -----Original Message-----
>> From: Ravi Roy [mailto:ravi.aroy@gmail.com]
>> Sent: Saturday, April 26, 2008 1:35 PM
>> To: Ant Users List
>> Subject: How to store date time as a long value into a text file.
>>
>>
>> Hi all,
>>
>> I have searched the archives, but I am not able to get the answer of 
>> my question. My problem is I want to create a file say "foo" and store 
>> current time as long value in that using Ant.
>>
>> For example :
>>
>> long myvar = System.currentTimeMillis();
>>
>> would produce a long value of current date time, which I want to store 
>> in "foo"
>>
>> I created the file :
>>
>> 	<target name="create.foo">
>>   	     <touch file="foo" />
>>   	</target>
>>
>> But I am not sure, I to store date time as long value into that file.. 
>> Does some have any idea ?
>>
>> Regards,
>> Ravi.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>   
>>     
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros


RE: How to store date time as a long value into a text file.

Posted by Ravi Roy <ra...@gmail.com>.
Sorry for dely in replying... I tried tstamp ant task, but it gives me the
date and time in the format I specify in pattern, while I wanted a long
value produced by  System.currentTimeMillis() in the created file.

Thanks for your response.
Regards
Ravi.

-----Original Message-----
From: Scot P. Floess [mailto:floess@mindspring.com] 
Sent: Sunday, April 27, 2008 7:33 PM
To: Ant Users List
Subject: Re: How to store date time as a long value into a text file.


Did you look at the tstamp task?

            <tstamp>
                <format  property = "some-property"  pattern = 
"yyyy-MM-dd_HH-mm-ss"/>
            </tstamp>

Ravi Roy wrote:
> Just to inform the list, I was not able to wokout this problem using 
> standard Ant task, I had to write small custom Ant task to solve this 
> problem -- which in fact I was trying to avoid ;-)
>
> Regards,
> Ravi.
>
>
> -----Original Message-----
> From: Ravi Roy [mailto:ravi.aroy@gmail.com]
> Sent: Saturday, April 26, 2008 1:35 PM
> To: Ant Users List
> Subject: How to store date time as a long value into a text file.
>
>
> Hi all,
>
> I have searched the archives, but I am not able to get the answer of 
> my question. My problem is I want to create a file say "foo" and store 
> current time as long value in that using Ant.
>
> For example :
>
> long myvar = System.currentTimeMillis();
>
> would produce a long value of current date time, which I want to store 
> in "foo"
>
> I created the file :
>
> 	<target name="create.foo">
>   	     <touch file="foo" />
>   	</target>
>
> But I am not sure, I to store date time as long value into that file.. 
> Does some have any idea ?
>
> Regards,
> Ravi.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros


---------------------------------------------------------------------
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


Re: How to store date time as a long value into a text file.

Posted by "Scot P. Floess" <fl...@mindspring.com>.
Did you look at the tstamp task?

            <tstamp>
                <format  property = "some-property"  pattern = 
"yyyy-MM-dd_HH-mm-ss"/>
            </tstamp>

Ravi Roy wrote:
> Just to inform the list, I was not able to wokout this problem using
> standard Ant task, I had to write small custom Ant task to solve this
> problem -- which in fact I was trying to avoid ;-)
>
> Regards,
> Ravi.
>
>
> -----Original Message-----
> From: Ravi Roy [mailto:ravi.aroy@gmail.com] 
> Sent: Saturday, April 26, 2008 1:35 PM
> To: Ant Users List
> Subject: How to store date time as a long value into a text file.
>
>
> Hi all,
>
> I have searched the archives, but I am not able to get the answer of my
> question. My problem is I want to create a file say "foo" and store current
> time as long value in that using Ant.
>
> For example :
>
> long myvar = System.currentTimeMillis();
>
> would produce a long value of current date time, which I want to store in
> "foo"
>
> I created the file :
>
> 	<target name="create.foo">
>   	     <touch file="foo" />
>   	</target>
>
> But I am not sure, I to store date time as long value into that file.. Does
> some have any idea ?
>
> Regards,
> Ravi.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>   

-- 
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros


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


RE: How to store date time as a long value into a text file.

Posted by Ravi Roy <ra...@gmail.com>.
Just to inform the list, I was not able to wokout this problem using
standard Ant task, I had to write small custom Ant task to solve this
problem -- which in fact I was trying to avoid ;-)

Regards,
Ravi.


-----Original Message-----
From: Ravi Roy [mailto:ravi.aroy@gmail.com] 
Sent: Saturday, April 26, 2008 1:35 PM
To: Ant Users List
Subject: How to store date time as a long value into a text file.


Hi all,

I have searched the archives, but I am not able to get the answer of my
question. My problem is I want to create a file say "foo" and store current
time as long value in that using Ant.

For example :

long myvar = System.currentTimeMillis();

would produce a long value of current date time, which I want to store in
"foo"

I created the file :

	<target name="create.foo">
  	     <touch file="foo" />
  	</target>

But I am not sure, I to store date time as long value into that file.. Does
some have any idea ?

Regards,
Ravi.


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