Cari di Apache Ant 
    Apache Ant User Manual
Daftar Isi
(Sebelumnya) TruncateTypedef (Berikutnya)
Apache Ant Tasks

TStamp

Tstamp

Description

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

These properties can be used in the build-file, for instance, to createtime-stamped filenames, or used to replace placeholder tags inside documentsto indicate, for example, the release date. The best place for this task isprobably 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 thatallows a property to be set to the current date and time in a given format.The date/time patterns are as defined in the JavaSimpleDateFormat 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 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 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,UK"/>  </tstamp>

sets the standard properties as well as the propertyTODAY_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 exampleis 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.

(Sebelumnya) TruncateTypedef (Berikutnya)