ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RADEMAKERS Tanguy <tanguy.rademak...@swift.com>
Subject Re: Creating a java file
Date Mon, 23 Feb 2004 14:26:03 GMT

    Tstamp


      Description

Sets the |DSTAMP|, |TSTAMP|, and |TODAY| properties in the current 
project. By default, the |DSTAMP| property is in the format "yyyyMMdd", 
|TSTAMP| is in the format "hhmm", and |TODAY| is in the format "MMMM dd 
yyyy". Use the nested <format> element to specify a different format.

These properties can be used in the build-file, for instance, to create 
time-stamped filenames, or used to replace placeholder tags inside 
documents to indicate, for example, the release date. The best place for 
this task is probably in an initialization target.


      Parameters

*Attribute* 	*Description* 	*Required*
prefix 	Prefix used for all properties set. The default is no prefix. 	No


      Nested Elements

The Tstamp task supports a |<format>| nested element that allows a 
property to be set to the current date and time in a given format. The 
date/time patterns are as defined in the Java SimpleDateFormat 
<http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html> 
class. The format element also allows offsets to be applied to the time 
to generate different time values.

*Attribute* 	*Description* 	*Required*
property 	The property to receive the date/time string in the given 
pattern. 	Yes
pattern 	The date/time pattern to be used. The values are as defined by 
the Java SimpleDateFormat class. 	Yes
timezone 	The timezone to use for displaying time. The values are as 
defined by the Java TimeZone 
<http://java.sun.com/products/jdk/1.2/docs/api/java/util/TimeZone.html> 
class. 	No
offset 	The numeric offset to the current time 	No
unit 	The unit of the offset to be applied to the current time. Valid 
Values are

    * millisecond
    * second
    * minute
    * hour
    * day
    * week
    * month
    * year

	No
locale 	The locale used to create date/time string. The general form is 
"language, country, variant" but either variant or variant and country 
may be omitted. For more information please refer to documentation for 
the Locale <http://java.sun.com/j2se/1.3/docs/api/java/util/Locale.html> 
class. 	No


      Examples

  <tstamp/>

sets the standard |DSTAMP|, |TSTAMP|, and |TODAY| properties according 
to the default formats.

  <tstamp>
    <format property="TODAY_UK" pattern="d-MMMM-yyyy" locale="en"/>
  </tstamp>

sets the standard properties as well as the property |TODAY_UK| with the 
date/time pattern "d-MMMM-yyyy" using English locale (eg. 21-May-2001).

  <tstamp>
      <format property="touch.time" pattern="MM/dd/yyyy hh:mm aa"
              offset="-5" unit="hour"/>
  </tstamp>

Creates a timestamp, in the property touch.time, 5 hours before the 
current time. The format in this example is suitable for use with the 
<touch> task. The standard properties are set also.

  <tstamp prefix="start"/>

Sets three properties with the standard formats, prefixed with "start.": 
|start.DSTAMP|, |start.TSTAMP|, and |start.TODAY|.

------------------------------------------------------------------------

Copyright © 2000-2004 The Apache Software Foundation. All rights Reserved.



Pritesh saharey wrote:

><filter token="DATE" value="${TODAY}"/>
>
>Sorry to trouble all you but i am unable to print the Todays date what should i do?
>
>
>Pritesh Saharey
>BE(Mech)
>Software Engineer
>Apsora(Ind.)Pvt. Ltd., Pune
>http://www.apsora.com
>http://in.geocities.com/priteshsaharey/
>
>
>
>--- "Craig Berry" <Craig.Berry@portblue.com> wrote:
>Just create a template VersionDate.java containing code like 
> 
>public class VersionDate { public static String VersionDate = "@date@";}
>
>Then run that through a filtered copy.  Or, almost equivalently, use an <echo> to
generate the file, as others have suggested.  I'd favor the filtered-copy method as it avoids
having source code living in your build.xml.
>
>
>	-----Original Message----- 
>	From: Pritesh saharey [mailto:pritesh@sqatester.com] 
>	Sent: Mon 2/23/2004 5:54 AM 
>	To: Ant Users List 
>	Cc: 
>	Subject: Re: Creating a java file
>	
>	
>
>	OK let us go like this, i want to create a java file VersionDate.java using ant, thsi
VersionDate.java file should contain code
>	public class VersionDate { public static String VersionDate = " Mon Dec 15 17:16:45 IST
2003 ";}
>	
>	and whenever ant command is run there this VersionDate.java file should be created with
that date on which the build is beign run for example if ant is run on Feb 23, 2004 than this
date along with code should get written in VersionDate.java file.
>	
>	are you clear or still need explanation if yes please please ask me
>	
>	
>	
>	Pritesh Saharey
>	BE(Mech)
>	Software Engineer
>	Apsora(Ind.)Pvt. Ltd., Pune
>	http://www.apsora.com
>	http://in.geocities.com/priteshsaharey/
>	
>	
>	
>	--- RADEMAKERS Tanguy <tanguy.rademakers@swift.com> wrote:
>	Then see the <echo file="xyz"> task.
>	
>	/t
>	
>	Pritesh saharey wrote:
>	
>	>Thanx but i wanted to create the whole VersionDate.java file and not only the date
to be displayed.
>	>
>	>
>	>Pritesh Saharey
>	>BE(Mech)
>	>Software Engineer
>	>Apsora(Ind.)Pvt. Ltd., Pune
>	>http://www.apsora.com
>	>http://in.geocities.com/priteshsaharey/
>	>
>	>
>	>
>	>--- RADEMAKERS Tanguy <tanguy.rademakers@swift.com> wrote:
>	>Pritesh,
>	>
>	>Take a look at FilterSets in the manual, under "Concepts and Types".
>	>
>	>/t
>	>
>	>
>	>Pritesh saharey wrote:
>	>
>	> 
>	>
>	>>Hello All,
>	>>       A very simple problem for you, i would like to create a java file using
ant in which i want to a code something like this
>	>>//----------------
>	>>public class VersionDate { public static String VersionDate = " Mon Dec 15 17:16:45
IST 2003 ";}
>	>>//----------------
>	>>In this java code VersionDate="" should be the date of running the build script.
>	>>
>	>>can anybody help me out.
>	>>
>	>>
>	>>Pritesh Saharey
>	>>BE(Mech)
>	>>Software Engineer
>	>>Apsora(Ind.)Pvt. Ltd., Pune
>	>>http://www.apsora.com
>	>>http://in.geocities.com/priteshsaharey/
>	>>
>	>>
>	>>_____________________________________________________________
>	>>Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm
>	>>
>	>>---------------------------------------------------------------------
>	>>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
>	>
>	>
>	>
>	>_____________________________________________________________
>	>Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm
>	>
>	>---------------------------------------------------------------------
>	>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
>	
>	
>	
>	_____________________________________________________________
>	Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm
>	
>	---------------------------------------------------------------------
>	To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>	For additional commands, e-mail: user-help@ant.apache.org
>	
>	
>
>
>
>_____________________________________________________________
>Join SQAtester.com Community  ---> http://www.sqatester.com/testersarea/joinus.htm
>
>---------------------------------------------------------------------
>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