159 lines
6.8 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Documenting T:NAnt.Core.Tasks.TStampTask-->
<head>
<meta http-equiv="Content-Language" content="en-ca" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../style.css" />
<title>&lt;tstamp&gt; Task</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
<tr>
<td class="NavBar-Cell">
<a href="http://nant.sourceforge.net">
<b>NAnt</b>
</a>
<img alt="-&gt;" src="../images/arrow.gif" />
<a href="../index.html">Help</a>
<img alt="-&gt;" src="../images/arrow.gif" />
<a href="../tasks/index.html">Task Reference</a>
<img alt="-&gt;" src="../images/arrow.gif" /> &lt;tstamp&gt;</td>
<td class="NavBar-Cell" align="right">
v0.91</td>
</tr>
</table>
<h1>&lt;tstamp&gt;</h1>
<p> Sets properties with the current date and time. </p>
<p> By default the <a href="../tasks/tstamp.html">&lt;tstamp&gt;</a> task displays the current date and time and sets the following properties: </p>
<ul style="list-style-type: disc;">
<li>tstamp.date to yyyyMMdd</li>
<li>tstamp.time to HHmm</li>
<li>tstamp.now using the default DateTime.ToString() method</li>
</ul>
<p> To set an additional property with a custom date/time use the <code>property</code> and <code>pattern</code> attributes. To set a number of additional properties with the exact same date and time use the <code>formatter</code> nested element (see example). </p>
<p> The date and time string displayed by the <a href="../tasks/tstamp.html">&lt;tstamp&gt;</a> task uses the computer's default long date and time string format. You might consider setting these to the <a href="http://www.cl.cam.ac.uk/~mgk25/iso-time.html">ISO 8601 standard for date and time notation</a>. </p>
<h3>Parameters</h3>
<div class="table">
<table>
<tr>
<th>Attribute</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
<th style="text-align: center;">Required</th>
</tr>
<tr>
<td valign="top">pattern</td>
<td style="text-align: center;">string</td>
<td>The date/time pattern to be used.</td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">property</td>
<td style="text-align: center;">string</td>
<td> The property to receive the date/time string in the given pattern. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">failonerror</td>
<td style="text-align: center;">bool</td>
<td> Determines if task failure stops the build, or is just reported. The default is <b>true</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">if</td>
<td style="text-align: center;">bool</td>
<td> If <b>true</b> then the task will be executed; otherwise, skipped. The default is <b>true</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">unless</td>
<td style="text-align: center;">bool</td>
<td> Opposite of <code>if</code>. If <b>false</b> then the task will be executed; otherwise, skipped. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">verbose</td>
<td style="text-align: center;">bool</td>
<td> Determines whether the task should report detailed build log messages. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
</table>
</div>
<h3>Nested Elements:</h3>
<!--Array-->
<!--NestedElementArray=T:NAnt.Core.Types.Formatter-->
<h4>
<a id="formatter">
</a>
&lt;formatter&gt;
</h4>
<div class="nested-element">
<p>
</p>
<h3>Parameters</h3>
<div class="table">
<table>
<tr>
<th>Attribute</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
<th style="text-align: center;">Required</th>
</tr>
<tr>
<td valign="top" class="required">pattern</td>
<td style="text-align: center;">string</td>
<td> The string pattern to use to format the property. </td>
<td style="text-align: center;">True</td>
</tr>
<tr>
<td valign="top" class="required">property</td>
<td style="text-align: center;">string</td>
<td> The name of the NAnt property to set. </td>
<td style="text-align: center;">True</td>
</tr>
<tr>
<td valign="top">if</td>
<td style="text-align: center;">bool</td>
<td> Indicates if the formatter should be used to format the timestamp. If <b>true</b> then the formatter will be used; otherwise, skipped. The default is <b>true</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">unless</td>
<td style="text-align: center;">bool</td>
<td> Indicates if the formatter should be not used to format the timestamp. If <b>false</b> then the formatter will be used; otherwise, skipped. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
</table>
</div>
</div>
<h4>
<a id="formatter">
</a>
&lt;/formatter&gt;
</h4>
<h3>Examples</h3>
<ul class="examples">
<li>
<p>Set the <code>build.date</code> property.</p>
<pre class="code">
&lt;tstamp property="build.date" pattern="yyyyMMdd" verbose="true" /&gt;
</pre>
</li>
<li>
<p>Set a number of properties for Ant like compatibility.</p>
<pre class="code">
&lt;tstamp verbose="true"&gt;
&lt;formatter property="TODAY" pattern="dd MMM yyyy"/&gt;
&lt;formatter property="DSTAMP" pattern="yyyyMMdd" unless="${date.not.needed}" /&gt;
&lt;formatter property="TSTAMP" pattern="HHmm" if="${need.hours}" /&gt;
&lt;/tstamp&gt;
</pre>
</li>
</ul>
<h3>Requirements</h3>
<div style="margin-left: 20px;">
<b>Assembly:</b> NAnt.Core (0.91.4312.0)
</div>
</body>
</html>