I present two tables that reformat the Python strptime, strftime documentation. The first is a short table with the most useful directives, the second is a longer table with all of the directives. This is easier for me to scan than the native docs. Hopefully it will help others as well.
Unit | Directive | Description | Example |
---|---|---|---|
YEAR | %Y | 4-digit | 1970, 1988, 2001, 2013 |
MONTH | %m | Decimal zero-padded | 01, 02, ..., 12 |
DAY | %d | Decimal zero-padded | 01, 02, ..., 31 |
HOUR | %H | 24-hour clock, zero-padded | 00, 01, ..., 23 |
MINUTE | %M | Decimal zero-padded | 00, 01, ..., 59 |
SECOND | %S | Decimal zero-padded | 00, 01, ..., 59 |
TIMEZONE | %z | UTC offset | (empty), +0000, -0400, +1030 |
ISO format | %Y-%m-%dT%H:%M:%S%z |
Unit | Directive | Description | Example |
---|---|---|---|
YEAR | %Y | 4-digit | 1970, 1988, 2001, 2013 |
%y | 2-digit | 00, 01, ..., 99 | |
MONTH | %m | Decimal zero-padded | 01, 02, ..., 12 |
%b | Name, localized short | Jan, Feb, ..., Dec (en_US); Jan, Feb, ..., Dez (de_DE) |
|
%B | Name, localized long | January, February, ..., December (en_US); Januar, Februar, ..., Dezember (de_DE) |
|
DAY | %d | Decimal zero-padded | 01, 02, ..., 31 |
%w | Day of week, decimal | 0, 1, ..., 6 | |
%a | Name of day, localized short | Sun, Mon, ..., Sat (en_US); So, Mo, ..., Sa (de_DE) |
|
%A | Name of day, localized long | Sunday, Monday, ..., Saturday (en_US); Sonntag, Montag, ..., Samstag (de_DE) |
|
HOUR | %H | 24-hour clock, zero-padded | 00, 01, ..., 23 |
%I | 12-hour clock, zero-padded | 01, 02, ..., 12 | |
%p | AM/PM, localized | AM, PM (en_US); am, pm (de_DE) | |
MINUTE | %M | Decimal zero-padded | 00, 01, ..., 59 |
SECOND | %S | Decimal zero-padded | 00, 01, ..., 59 |
%f | Microsecond, decimal zero-padded | 000000, 000001, ..., 999999 | |
TIMEZONE | %z | UTC offset | (empty), +0000, -0400, +1030 |
%Z | Name | (empty), UTC, EST, CST | |
MISC | %j | Day of year, 3 digit decimal zero-padded | 001, 002, ..., 366 |
%U | Week of year, first Sunday, 2 digit decimal zero-padded | 00, 01, ..., 53 | |
%W | Week of year, first Monday, 2 digit decimal zero-padded | 00, 01, ..., 53 | |
PRE-FORMATTED | %c | Localized pre-formatted | Tue Aug 16 21:30:00 1988 (en_US); Di 16 Aug 21:30:00 1988 (de_DE) |
%x | Localized date only | 08/16/88 (None); 08/16/1988 (en_US); 16.08.1988 (de_DE) |
|
%X | Localized time only | 21:30:00 (en_US); 21:30:00 (de_DE) |
|
% | %% | % | % |