Date Specifiers | |
Format | Explanation |
%a |
abbreviated name of day of the week |
%A |
full name of day of the week |
%b or %h |
abbreviated name of the month |
%B |
full name of the month |
%d |
day of the month, 01-31 |
%D |
shorthand for "%m/%d/%y" (only output) |
%F |
shorthand for "%Y-%m-%d" (only output) |
%k |
hour, 0-23 (one or two digits) |
%H |
hour, 00-23 (always two digits) |
%l |
hour, 1-12 (one or two digits) |
%I |
hour, 01-12 (always two digits) |
%j |
day of the year, 001-366 |
%m |
month, 01-12 |
%M |
minute, 00-60 |
%p |
"am" or "pm" |
%r |
shorthand for "%I:%M:%S %p" (only output) |
%R |
shorthand for %H:%M" (only output) |
%S |
second, integer 00-60 on output, (double) on input |
%s |
number of seconds since start of year 1970 |
%T |
shorthand for "%H:%M:%S" (only output) |
%U |
week of the year (week starts on Sunday) |
%w |
day of the week, 0-6 (Sunday = 0) |
%W |
week of the year (week starts on Monday) |
%y |
year, 0-99 in range 1969-2068 |
%Y |
year, 4-digit |
%z |
timezone, [+-]hh:mm |
%Z |
timezone name, ignored string |
Numerical formats may be preceded by a "0" ("zero") to pad the field with leading zeroes, and preceded by a positive digit to define the minimum field width. The %S, and %t formats also accept a precision specifier so that fractional hours/minutes/seconds can be written.
Time Specifiers | |
Format | Explanation |
%tH |
+/- hours relative to time=0 (does not wrap at 24) |
%tM |
+/- minutes relative to time=0 |
%tS |
+/- seconds associated with previous tH or tM field |