Date/time Formatting¶
Date/time formats use Numbers notation rather than POSIX strftime
as there are a number
of extensions. Date components are specified using directives which must be separated by
whitespace. Supported directives are:
Directive |
Meaning |
Example |
---|---|---|
|
Locale’s AM or PM |
am, pm |
|
Full weekday name |
Monday, Tuesday, … |
|
Abbreviated weekday name |
Mon, Tue, … |
|
Year with century as a decimal number |
1999, 2023, etc. |
|
Year without century as a zero-padded decimal number |
00, 01, … 99 |
|
Year without century as a decimal number |
0, 1, … 99 |
|
Full month name |
January, February, … |
|
Abbreviated month name |
Jan, Feb, … |
|
Month as a zero-padded decimal number |
01, 02, … 12 |
|
Month as a decimal number |
1, 2, … 12 |
|
Day as a decimal number |
1, 2, … 31 |
|
Day as a zero-padded decimal number |
01, 02, … 31 |
|
Day of the year as a zero-padded 3-digit number |
001 - 366 |
|
Day of the year as a minimum zero-padded 2-digit number |
01 - 366 |
|
Day of the year |
1 - 366 |
|
Hour (24-hour clock) as a zero-padded decimal number |
00, 01, … 23 |
|
Hour (24-hour clock) as a decimal number |
0, 1, … 23 |
|
Hour (12-hour clock) as a zero-padded decimal number |
01, 02, … 12 |
|
Hour (12-hour clock) as a decimal number |
1, 2, … 12 |
|
Hour (24-hour clock) as a decimal number to 24 |
1, 2, … 24 |
|
Hour (24-hour clock) as a zero-padded decimal number to 24 |
01, 02, … 24 |
|
Hour (12-hour clock) as a decimal number from 0 |
0, 1, … 11 |
|
Hour (12-hour clock) as a zero-padded decimal number from 0 |
00, 01, … 11 |
|
Minutes as a zero-padded number |
00, 01, … 59 |
|
Minutes as a number |
0, 1, … 59 |
|
Seconds as a zero-padded number |
00, 01, … 59 |
|
Seconds as a number |
0, 1, … 59 |
|
Week number in the month (first week is zero) |
0, 1, … 5 |
|
Week number of the year (Monday as the first day of the week) |
0, 1, … 53 |
|
AD or BC (only AD is supported) |
AD |
|
How many times the day of falls in the month |
1, 2, … 5 |
|
Seconds to one decimal place |
0 - 9 |
|
Seconds to two decimal places |
00 - 99 |
|
Seconds to three decimal places |
000 - 999 |
|
Seconds to four decimal places |
0000 - 9999 |
|
Seconds to five decimal places |
00000 - 9999 |