Date & time format

Date format

The recognized modifiers to specify the date format are

Specifier Description Source Match
y The year from 0 to 99. 2019-06-05 19
y 2001-01-28 1
yy The year from 00 to 99. 2001-06-05 19
yy 2001-01-28 01
yyy Same as yyyy
yyyy The 4-digit year. 2019-06-05 2019
yyyy 2001-01-28 2001
M The month from 1 to 12. 2019-12-05 12
M 2001-01-28 1
MM The month from 01 to 12. 2019-12-05 12
MM 2001-01-28 01
MMM The abbreviated month. 2019-12-05 Dec
MMM 2001-01-28 Jan
MMMM The full-word month. 2019-12-05 December
MMMM 2001-01-28 January
d The day from 1 to 31. 2019-12-05 5
d 2001-01-28 28
dd The day from 01 to 31. 2019-12-05 05
dd 2001-01-28 28
ddd The abbreviated weekday. 2022-09-26 Mon
dddd The full-word weekday. 2022-09-26 Monday

Any other character, that isn’t listed as a specifier, is written to the formatted output.

Some characters are reserved for future use: w, v and \.

Time format

Used by the printTime, parseTime and tryParseTime functions

Specifier Description Source Match
h The hour, using a 12-hour clock from 1 to 12. 2009-06-15T01:45:30 1
hh 2009-06-15T13:45:30 1
H The hour, using a 24-hour clock from 0 to 23 2009-06-15T01:45:30 1
HH
K Time zone information
m The minute, from 0 to 59. 2009-06-15T01:09:30 9
mm 2009-06-15T01:45:30 45
s The second, from 0 to 59. 2009-06-15T13:45:09 9
ss
t The first character of the AM/PM designator
tt The AM/PM designator
User Contributed Notes
0 notes + add a note