NAnt SDK Documentation - v0.92 |

# TStampTask Class

Sets properties with the current date and time.

For a list of all members of this type, see TStampTask Members.

System.Object
NAnt.Core.Element
NAnt.Core.Task
NAnt.Core.Tasks.TStampTask

[Visual Basic]
<TaskName(Name:="tstamp")>
Public Class TStampTask
Inherits Task
[C#]
[TaskName(Name="tstamp")]
public class TStampTask : Task

#### Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

#### Remarks

By default the TStampTask displays the current date and time and sets the following properties:

- tstamp.date to yyyyMMdd
- tstamp.time to HHmm
- tstamp.now using the default DateTime.ToString() method

To set an additional property with a custom date/time use the Property and Pattern attributes. To set a number of additional properties with the exact same date and time use the Formatters nested element (see example).

The date and time string displayed by the TStampTask uses the computer's default long date and time string format. You might consider setting these to the ISO 8601 standard for date and time notation.

#### Example

Set the `build.date` property.

    <tstamp property="build.date" pattern="yyyyMMdd" verbose="true" />

Set a number of properties for Ant like compatibility.

    <tstamp verbose="true">
        <formatter property="TODAY" pattern="dd MMM yyyy"/>
        <formatter property="DSTAMP" pattern="yyyyMMdd" unless="${date.not.needed}" />
        <formatter property="TSTAMP" pattern="HHmm" if="${need.hours}" />
    </tstamp>

#### Requirements

Namespace: NAnt.Core.Tasks

Assembly: NAnt.Core (in NAnt.Core.dll)

#### See Also

TStampTask Members | NAnt.Core.Tasks Namespace