Sets the DSTAMP
, TSTAMP
, and TODAY
properties in the
current project. By default, the DSTAMP
property is in the format "%Y%m%d"
,
TSTAMP
is in the format "%H%M"
, and TODAY
is in the
format "%B %d %Y"
. 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.
the magic property phing.tstamp.now can be used to specify a fixed date value in order to create reproducible builds. Its value must be a number and is interpreted as seconds since the epoch (midnight 1970-01-01). With phing.tstamp.now.iso you could also specify that value in DateTime compatible format. If you specify a value in an invalid format an INFO message will be logged and the value will be ignored.
Table B.70: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
prefix
|
String
| Prefix used for all properties set. | n/a | No |
<tstamp/>
sets the standard DSTAMP, TSTAMP, and TODAY properties according to the default formats.
<tstamp> <format property="DATE" pattern="%c" locale="nl_NL"/> </tstamp>
sets the standard properties as well as the property DATE with the date/time pattern "%c" using the Dutch locale.
<tstamp prefix="start"/>
sets three properties with the standard formats, prefixed with "start.": start.DSTAMP, start.TSTAMP, and start.TODAY.
format
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 PHP strftime()
function.
Table B.71: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
property
|
String
| The property to receive the date/time string in the given pattern. | n/a | Yes |
pattern
|
String
| The date/time pattern to be used. The values are as defined by the PHP strftime() function. | n/a | Yes |
locale
|
String
| The locale used to create date/time string. For more information see the PHP setlocale() function. | n/a | No |
timezone
|
String
| The timezone to use for displaying time. | n/a | No |