Format specifier

Description

d

The day of the month. Singledigit days will not have a leading zero.

dd

The day of the month. Singledigit 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.

h

The hour in a 12hour clock. Singledigit hours will not have a leading zero.

hh

The hour in a 12hour clock. Singledigit hours will have a leading zero.

H

The hour in a 24hour clock. Singledigit hours will not have a leading zero.

HH

The hour in a 24hour clock. Singledigit hours will have a leading zero.

m

The minute. Singledigit minutes will not have a leading zero.

mm

The minute. Singledigit minutes will have a leading zero.

M

The numeric month. Singledigit months will not have a leading zero.

MM

The numeric month. Singledigit months will have a leading zero.

MMM

The abbreviated name of the month.

MMMM

The full name of the month.

s

The second. Singledigit seconds will not have a leading zero.

ss

The second. Singledigit seconds will have a leading zero.

tt

Represents the A.M./P.M. designator. The A.M. designator is used if the hour in the time being formatted is less than 12; otherwise, the P.M. designator is used.

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.

yyy

The year in three digits. If the year is less than 100, the year is displayed with a leading zero.

yyyy

The year in four or five digits (depending on the calendar used), including the century. Will pad with leading zeroes to get four digits. Thai Buddhist and Korean calendars both have five digit years; users selecting the "yyyy" pattern will see all five digits without leading zeros for calendars that have five digits. Exception: the Japanese and Taiwan calendars always behave as if "yy" was selected.

yyyyy

The year in six digits. Will pad with leading zeroes to get six digits. Exception: the Japanese and Taiwan calendars always behave as if "yy" was selected. The pattern can be continued with a longer string of "y"s padding with more leading zeroes.

z

The time zone offset ("+" or "" followed by the hour only). Singledigit 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). Singledigit hours will have a leading zero.

zzz

The full time zone offset ("+" or "" followed by the hour and minutes). Singledigit hours and minutes will have leading zeros. For example, Pacific Standard Time is "08:00".

:

The default time separator.

/

The default date separator.

\ c

Where c is any character. Displays the character literally. To display the backslash character, use "\\".
