Time Patterns

Pattern Variables

dRepresents the day of the month as a number from 1 through 31. No leading zero
ddRepresents the day of the month as a number from 01 through 31. A single-digit day is formatted with a leading zero
dddRepresents the abbreviated name of the day of the week (Mon, Tues, Wed etc)
ddddRepresents the full name of the day of the week (Monday, Tuesday etc)
hhour clock hour (e.g. 7)
hhhour clock, with a leading 0 (e.g. 07)
H24-hour clock hour (e.g. 19)
HH24-hour clock hour, with a leading 0 (e.g. 07)
mMinutes
mmMinutes with a leading zero
MMonth number
MMMonth number with leading zero
MMMAbbreviated Month Name (e.g. Dec)
MMMMFull month name (e.g. December)
sSeconds
ssSeconds with leading zero
tAbbreviated AM / PM (e.g. A or P)
ttAM/PM (e.g. AM or PM)
yYear, no leading zero (e.g. 2001 would be 1)
yyYear, leadin zero (e.g. 2001 would be 01)
yyyYear, (e.g. 2001 would be 2001)
yyyyYear, (e.g. 2001 would be 2001)
KRepresents the time zone information of a date and time value (e.g. +05:00)
zWith DateTime values, represents the signed offset of the local
operating system’s time zone from Coordinated Universal Time (UTC),
measured in hours. (e.g. +6)
zzAs z but with leadin zero (e.g. +06)
zzzWith DateTime values, represents the signed offset
of the local operating system’s time zone from UTC,
measured in hours and minutes. (e.g. +06:00)
fRepresents the most significant digit of the seconds fraction;
that is, it represents the tenths of a second in a date and time value.
ffRepresents the two most significant digits of the seconds fraction;
that is, it represents the hundredths of a second in a date and time value.
fffRepresents the three most significant digits of the seconds fraction;
that is, it represents the milliseconds in a date and time value.
ffffRepresents the four most significant digits of the seconds fraction;
that is, it represents the ten thousandths of a second in a date and time value.
fffffRepresents the five most significant digits of the seconds fraction;
that is, it represents the hundred thousandths of a second in a date and time value.
ffffffRepresents the six most significant digits of the seconds fraction;
that is, it represents the millionths of a second in a date and time value.
fffffffRepresents the seven most significant digits of the seconds fraction;
that is, it represents the ten millionths of a second in a date and time value.

Pattern Examples

Format StringOutput
MM/dd/yyyy08/22/2006
dddd, dd MMMM yyyyTuesday, 22 August 2006
dddd, dd MMMM yyyy HH:mmTuesday, 22 August 2006 06:30
dddd, dd MMMM yyyy hh:mm ttTuesday, 22 August 2006 06:30 AM
dddd, dd MMMM yyyy H:mmTuesday, 22 August 2006 6:30
dddd, dd MMMM yyyy h:mm ttTuesday, 22 August 2006 6:30 AM
dddd, dd MMMM yyyy HH:mm:ssTuesday, 22 August 2006 06:30:07
MM/dd/yyyy HH:mm08/22/2006 06:30
MM/dd/yyyy hh:mm tt08/22/2006 06:30 AM
MM/dd/yyyy H:mm08/22/2006 6:30
MM/dd/yyyy h:mm tt08/22/2006 6:30 AM
MM/dd/yyyy h:mm tt08/22/2006 6:30 AM
MM/dd/yyyy h:mm tt08/22/2006 6:30 AM
MM/dd/yyyy HH:mm:ss08/22/2006 06:30:07
MMMM ddAugust 22
MMMM ddAugust 22
yyyy–MM–ddTHH:mm:ss.fffffffK2006–08–22T06:30:07.7199222–04:00
yyyy–MM–ddTHH:mm:ss.fffffffK2006–08–22T06:30:07.7199222–04:00
ddd, dd MMM yyyy HH‘:‘mm‘:‘ss ‘GMT‘Tue, 22 Aug 2006 06:30:07 GMT
ddd, dd MMM yyyy HH‘:‘mm‘:‘ss ‘GMT‘Tue, 22 Aug 2006 06:30:07 GMT
yyyy‘–‘MM‘–‘dd‘T‘HH‘:‘mm‘:‘ss2006–08–22T06:30:07
HH:mm06:30
hh:mm tt06:30 AM
H:mm6:30
h:mm tt6:30 AM
HH:mm:ss06:30:07
yyyy‘–‘MM‘–‘dd HH‘:‘mm‘:‘ss‘Z‘2006–08–22 06:30:07Z
dddd, dd MMMM yyyy HH:mm:ssTuesday, 22 August 2006 06:30:07
yyyy MMMM2006 August
yyyy MMMM2006 August