blob: 894d985964ea497cc271c0ca6e61b420f4c5eaf1 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Ant User Manual</title>
</head>
<body>
<h2><a name="tstamp">Tstamp</a></h2>
<h3>Description</h3>
<p>Sets the <code>DSTAMP</code>, <code>TSTAMP</code>, and <code>TODAY</code>
properties in the current project. The <code>DSTAMP</code> property is in the
format &quot;yyyymmdd&quot;, <code>TSTAMP</code> is in the
format &quot;hhmm&quot;, and <code>TODAY</code> is in the
format &quot;month day year&quot;.
<p>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.
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr> <td colspan="3"> No parameters</td>
</tr>
</table>
<h3>Nested Elements</h3>
The Tstamp task supports a <code>&lt;format&gt;</code> 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
<a href="http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html">SimpleDateFormat</a> class.
The format element also allows offsets to be applied to the time to generate different time values.
<br><br>
<table width="60%" border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">property</td>
<td valign="top">
The property to receive the date/time string in the given pattern.
</td>
<td align="center" valign="top">Yes</td>
</tr>
<tr>
<td valign="top">pattern</td>
<td valign="top">The date/time pattern to be used. The values are as defined by the Java SimpleDateFormat class.</td>
<td align="center" valign="top">Yes</td>
</tr>
<tr>
<td valign="top">offset</td>
<td valign="top">The numeric offset to the current time</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">unit</td>
<td valign="top">The unit of the offset to be applied to the current time.
Valid Values are
<ul>
<li>millisecond</li>
<li>second</li>
<li>minute</li>
<li>hour</li>
<li>day</li>
<li>week</li>
<li>month</li>
<li>year</li>
</ul>
</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">locale</td>
<td valign="top">The locale used to create date/time string. The general
form is &quot;language, country, variant&quot; but either variant or variant and
country may be omitted. For more information please refer to documentation
for the
<a href="http://java.sun.com/j2se/1.3/docs/api/java/util/Locale.html">Locale</a>
class.</td>
<td align="center" valign="top">No</td>
</tr>
</table>
<h3>Examples</h3>
<pre>
&lt;tstamp/&gt;
</pre>
<p>
sets the standard <code>DSTAMP</code>, <code>TSTAMP</code>,
and <code>TODAY</code> properties according to the default formats.</p>
<pre>
&lt;tstamp&gt;
&lt;format property=&quot;TODAY_UK&quot; pattern=&quot;d-MMMM-yyyy&quot; locale=&quot;en&quot;/&gt;
&lt;/tstamp&gt;
</pre>
<p>
sets the standard properties as well as the property
<code>TODAY_UK</code> with the date/time pattern &quot;d-MMMM-yyyy&quot;
using English locale (eg. 21-May-2001).
<pre>
&lt;tstamp&gt;
&lt;format property=&quot;touch.time&quot; pattern=&quot;MM/dd/yyyy hh:mm aa&quot;
offset=&quot;-5&quot; unit=&quot;hour&quot;/&gt;
&lt;/tstamp&gt;
</pre>
<p>
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 &lt;touch&gt; task</p>
<hr>
<p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights Reserved.</p>
</body>
</html>