Child pages
  • Appendix. Datetime format

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Format charDescriptionExample output
a‘a.m.’ or ‘p.m.’‘a.m.’
A‘AM’ or ‘PM’‘AM’
bMonth, textual, 3 letters, lowercase.‘jan’
BNot implemented. 
dDay of the month, 2 digits with leading zeros.‘01’ to ‘31’
DDay of the week, textual, 3 letters.‘Fri’
fTime, in 12-hour hours and minutes, with minutes left off if they’re zero.‘1’, ‘1:30’
FMonth, textual, long.‘January’
gHour, 12-hour format without leading zeros.‘1’ to ‘12’
GHour, 24-hour format without leading zeros.‘0’ to ‘23’
hHour, 12-hour format.‘01’ to ‘12’
HHour, 24-hour format.‘00’ to ‘23’
iMinutes.‘00’ to ‘59’
INot implemented. 
jDay of the month without leading zeros.‘1’ to ‘31’
lDay of the week, textual, long.‘Friday’
LBoolean for whether it’s a leap year.True or False
mMonth, 2 digits with leading zeros.‘01’ to ‘12’
MMonth, textual, 3 letters.‘Jan’
nMonth without leading zeros.‘1’ to ‘12’
NMonth abbreviation in Associated Press style.‘Jan.’, ‘Feb.’, ‘March’, ‘May’
ODifference to Greenwich time in hours.‘+0200’
PTime, in 12-hour hours, minutes and ‘a.m.’/’p.m.’ with extensions1 a.m.’, ‘1:30 p.m.’, ‘midnight’, ‘noon’
rRFC 2822 formatted date.‘Thu, 21 Dec 2000 16:01:07 +0200’
sSeconds, 2 digits with leading zeros.‘00’ to ‘59’
SEnglish ordinal suffix for day of the month, 2 characters.‘st’, ‘nd’, ‘rd’ or ‘th’
tNumber of days in the given month.28 to 31
TTime zone of this machine.‘EST’, ‘MDT’
UNot implemented. 
wDay of the week, digits without leading zeros.‘0’ (Sunday) to ‘6’ (Saturday)
WISO-8601 week number of year, with weeks starting on Monday.1, 53
yYear, 2 digits.‘99’
YYear, 4 digits.‘1999’
zDay of the year.0 to 365
ZTime zone offset in seconds. (West of UTC is negative, east - positive.)-43200 to 43200