<tstamp> Element

Format

<tstamp>
  { <format property="a_name" pattern="a_date_time_format /> }
</tstamp>

Description

Sets time related properties in the enclosing  element. Like in other elements that set  properties, the properties set by <tstamp> are set on the immediate enclosing element, and that they are set at parse time.

Note that, unlike Ant's <tstamp> which is a task, Want's <tstamp> is an element that can be used anywhere in the build script. Note also that property names are lowercase, and that more properties are set than those set in Ant.

The properties set are:

property format
dstamp yyyymmdd
tstamp hhnn
today mmm ddd d yyyy
year  yyyy
month  mm
day  dd
hour  hh
minute  nn
second  ss
ticks 8 digits

All the formats, except the one for the ticks property, are interpreted by Delphi's SysUtils.FormatDateTime() routine. The ticks property holds the number of milliseconds since midnight, and is formatted to eight zero-padded positions.

The properties can be used in the buildfile, for instance, to create timestamped filenames or used to replace placeholder tags inside documents to indicate, for example, the release date. The best place for this element is somewhere among your global property definitions.

Parameters

Attribute Description Required
No parameters

Nested Elements

The tstamp task supports a format nested element which allows a property to be given the current date and time in a given format. The date/time patterns are as defined in the Delphi SysUtils.FormatDateTime() routine.
Attribute Description Required
property The property which is to receive the date/time string in the given pattern Yes
pattern The date/time pattern to be used. The values are defined by the Java SimpleDateFormat class Yes

Examples

Set the standard time properties on the owner according to the formats above

<tstamp/>

As for the above example, set the standard properties and also set the property "TODAY_UK" with the date/time pattern "d mmm yyyy"

  <tstamp>
    <format property="TODAY_UK" pattern="d mmm yyyy">
  </tstamp>