Pattern Property

NAnt SDK Documentation - v0.92 |

# TStampTask.Pattern Property

The date/time pattern to be used.

[Visual Basic]
<TaskAttribute(Required:=False, Name:="pattern", ExpandProperties:=True, ProcessXml:=True)>
Public Property Pattern As String
[C#]
[TaskAttribute(Required=False, Name="pattern", ExpandProperties=True, ProcessXml=True)]
public string Pattern {get; set;}

#### Remarks

The following table lists the standard format characters for each standard pattern. The format characters are case-sensitive; for example, 'g' and 'G' represent slightly different patterns.

Format Character | Description Example Format Pattern (en-US)
--- | ---
d | MM/dd/yyyy
D | dddd, dd MMMM yyyy
f | dddd, dd MMMM yyyy HH:mm
F | dddd, dd MMMM yyyy HH:mm:ss
g | MM/dd/yyyy HH:mm
G | MM/dd/yyyy HH:mm:ss
m, M | MMMM dd
r, R | ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
s | yyyy'-'MM'-'dd'T'HH':'mm':'ss
t | HH:mm
T | HH:mm:ss
u | yyyy'-'MM'-'dd HH':'mm':'ss'Z'
U | dddd, dd MMMM yyyy HH:mm:ss
y, Y | yyyy MMMM

The following table lists the patterns that can be combined to construct custom patterns. The patterns are case-sensitive; for example, "MM" is recognized, but "mm" is not. If the custom pattern contains white-space characters or characters enclosed in single quotation marks, the output string will also contain those characters. Characters not defined as part of a format pattern or as format characters are reproduced literally.

Format | Pattern Description
--- | ---
d | The day of the month. Single-digit days will not have a leading zero.
dd | The day of the month. Single-digit days will have a leading zero.
ddd | The abbreviated name of the day of the week.
dddd | The full name of the day of the week.
M | The numeric month. Single-digit months will not have a leading zero.
MM | The numeric month. Single-digit months will have a leading zero.
MMM | The abbreviated name of the month.
MMMM | The full name of the month.
y | The year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.
yy | The year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.
yyyy | The year in four digits, including the century.
gg | The period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string.
h | The hour in a 12-hour clock. Single-digit hours will not have a leading zero.
hh | The hour in a 12-hour clock. Single-digit hours will have a leading zero.
H | The hour in a 24-hour clock. Single-digit hours will not have a leading zero.
HH | The hour in a 24-hour clock. Single-digit hours will have a leading zero.
m | The minute. Single-digit minutes will not have a leading zero.
mm | The minute. Single-digit minutes will have a leading zero.
s | The second. Single-digit seconds will not have a leading zero.
ss | The second. Single-digit seconds will have a leading zero.
f | The fraction of a second in single-digit precision. The remaining digits are truncated.
ff | The fraction of a second in double-digit precision. The remaining digits are truncated.
fff | The fraction of a second in three-digit precision. The remaining digits are truncated.
ffff | The fraction of a second in four-digit precision. The remaining digits are truncated.
fffff | The fraction of a second in five-digit precision. The remaining digits are truncated.
ffffff | The fraction of a second in six-digit precision. The remaining digits are truncated.
fffffff | The fraction of a second in seven-digit precision. The remaining digits are truncated.
t | The first character in the AM/PM designator.
tt | The AM/PM designator.
z | The time zone offset ("+" or "-" followed by the hour only). Single-digit hours will not have a leading zero. For example, Pacific Standard Time is "-8".
zz | The time zone offset ("+" or "-" followed by the hour only). Single-digit hours will have a leading zero. For example, Pacific Standard Time is "-08".
zzz | The full time zone offset ("+" or "-" followed by the hour and minutes). Single-digit hours and minutes will have leading zeros. For example, Pacific Standard Time is "-08:00".
: | The default time separator.
/ | The default date separator.
\ c | Pattern Where c is any character. Displays the character literally. To display the backslash character, use "\\".

#### See Also

TStampTask Class | NAnt.Core.Tasks Namespace