Date/Time Format Mask

The following format characters specify the custom format string for a date-time string (please note that the format characters are case sensitive):

Element Description
d The one- or two-digit day.
dd The two-digit day. Single-digit day values are preceded by a zero.
ddd The three-character weekday abbreviation.
dddd The full weekday name.
h The one- or two-digit hour in 24-hour format.
hh The two-digit hour in 24-hour format. Single-digit values are preceded by a zero.
n The one- or two-digit minute.
nn The two-digit minute. Single-digit values are preceded by a zero.
m The one- or two-digit month number.
mm The two-digit month number. Single-digit values are preceded by a zero.
mmm The three-character month abbreviation.
mmmm The full month name.
s The one- or two-digit second.
ss The two-digit second. Single-digit values are preceded by a zero.
t Displays the time using the format given by the ShortTimeFormat global variable.
tt Displays the time using the format given by the LongTimeFormat global variable.
yy The last two digits of the year (that is, 2001 would be displayed as "01").
yyyy The full year (that is, 2001 would be displayed as "2001").
z Displays the millisecond without a leading zero (0-999).
zzz Displays the millisecond with a leading zero (000-999).

To include literal strings in the format, enclose them in single or double quotation marks. Failing to quote literal strings can have unpredictable results, even if they do not include formatting codes. Use two single quotes to represent one single quote character in a literal string.