\ | can be used instead of % | |
\\ | a literal \ | \ |
%% | a literal % | % |
%a | locale's abbreviated weekday name | Sun |
%A | locale's full weekday name | Sunday |
%b | locale's abbreviated month name | Feb |
%B | locale's full month name | February |
%c | locale's date and time | Thu Mar 3 23:05:25 2005 |
%C | century; like %Y , except omit last two digits | 20 |
%d | day of month | 26 |
%D | date; same as %m/%d/%y | 02/26/22 |
%e | day of month, space padded; same as %_d | 2 |
%F | full date; same as %Y-%m-%d | 2022-02-26 |
%g | last two digits of year of ISO week number (see %G ) | 22 |
%G | year of ISO week number (see %V ); normally useful only with %V | 2022 |
%h | same as %b | Feb |
%H | hour (00..23 ) | 11 |
%I | hour (01..12 ) | 23 |
%j | day of year (001..366 ) | 073 |
%k | hour, space padded 0-23 ; same as %\_H | 7 |
%l | hour, space padded 1-12 ; same as %\_I | 7 |
%m | month (01..12 ) | 02 |
%M | minute (00..59 ) | 22 |
%n | a newline | \n |
%N | nanoseconds (000000000..999999999 ) | 000000000 |
%p | locale's equivalent of either AM or PM ; blank if not known | AM |
%P | like %p , but lower case | am |
%q | quarter of year (1..4 ) | 1 |
%r | locale's 12-hour clock time | 11:22:33 PM |
%R | 24-hour hour and minute; same as %H:%M | 23:22 |
%s | seconds since 1970-01-01 00:00:00 UTC | 1647282830 |
%S | second (00..60 ) | 33 |
%t | a tab | \t |
%T | time; same as %H:%M:%S | 23:22:33 |
%u | day of week (1..7 ); 1 is Monday | 1 |
%U | week number of year, with Sunday as first day of week (00..53 ) | 11 |
%V | ISO week number, with Monday as first day of week (01..53 ) | 11 |
%w | day of week (0..6 ); 0 is Sunday | 1 |
%W | week number of year, with Monday as first day of week (00..53 ) | 11 |
%x | locale's date representation | 03/14/22 |
%X | locale's time representation | 20:36:30 |
%y | last two digits of year | 22 |
%Y | year | 2022 |
%z | +hhmm numeric time zone | +0000 |
%:z | +hh:mm numeric time zone | +00:00 |
%::z | +hh:mm:ss numeric time zone | +00:00:00 |
%:::z | numeric time zone with : to necessary precision | +00, +00:00 |
%Z | alphabetic time zone abbreviation (e.g., EDT ) | GMT |