Date and time patterns

When defining data type options for date and time data, you can create your own custom date or time pattern if the predefined ones do not meet your needs. To create a date or time pattern, use the notation described in the table below. For example, this pattern:

dd MMMM yyyy

Would produce a date like this:

14 December 2020

Letter Description Example
G Era designator AD
yy Two-digit year 96
yyyy Four-digit year 1996
M Numeric month of the year. 7
MM Numeric month of the year. If the number is less than 10 a zero is added to make it a two-digit number. 07
MMM Short name of the month Jul
MMMM Long name of the month July
w Week of the year 27
ww Two-digit week of the year. If the week is less than 10 an extra zero is added. 06
W Week of the month 2
D Day of the year 189
DDD Three-digit day of the year. If the number contains less than three digits, zeros are added. 006
d Day of the month 10
dd Two-digit day of the month. Numbers less than 10 have a zero added. 09
F Day of the week in month 2
E Short name of the day of the week Tue
EEEE Long name of the day of the week Tuesday
a AM PM marker PM
H Hour of the day, with the first hour being 0 and the last hour being 23. 0
HH Two-digit hour of the day, with the first hour being 0 and the last hour being 23. Numbers less than 10 have a zero added. 08
k Hour of the day, with the first hour being 1 and the last hour being 24. 24
kk Two-digit hour of the day, with the first hour being 1 and the last hour being 24. Numbers less than 10 have a zero added. 02
K Hour hour of the morning (AM) or afternoon (PM), with 0 being the first hour and 11 being the last hour. 0
KK Two-digit hour of the day, with the first hour being 1 and the last hour being 24. Numbers less than 10 have a zero added. 02
h Hour of the morning (AM) or afternoon (PM), with 1 being the first hour and 12 being the last hour. 12
hh Two-digit hour of the morning (AM) or afternoon (PM), with 1 being the first hour and 12 being the last hour. Numbers less than 10 have a zero added. 09
m Minute of the hour 30
mm Two-digit minutes of the hour. Numbers less than 10 have a zero added. 05
s Second of the minute 55
ss Two-digit second of the minute. Numbers less than 10 have a zero added. 02
S Millisecond of the second 978
SSS Three-digit millisecond of the second. Numbers containing fewer than three digits will have one or two zeros added to make them three digits.

978
078
008

z Time abbreviation of the time zone name. If the time zone does not have a name, the GMT offset.

PST
GMT-08:00

zzzz The full time zone name. If the time zone does not have a name, the GMT offset.

Pacific Standard Time
GMT-08:00

Z The RFC 822 time zone. -0800
X The ISO 8601 time zone. -08Z
XX The ISO 8601 time zone with minutes. -0800Z
XXX The ISO 8601 time zone with minutes and a colon separator between hours and minutes. -08:00Z