Tic-mark label Date/Time Format 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, 1-31 |
%D |
shorthand for "%m/%d/%y" |
%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, 1-366 |
%m |
month, 1-12 |
%M |
minute, 0-60 |
%p |
"am" or "pm" |
%r |
shorthand for "%I:%M:%S %p" |
%R |
shorthand for %H:%M" |
%S |
second, 0-60 |
%T |
shorthand for "%H:%M:%S" |
%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 |
%Y |
year, 4-digit |
Except for the non-numerical formats, these may be preceded by a "0" ("zero", not "oh") to pad the field length with leading zeroes, and a positive digit, to define the minimum field width (which will be overridden if the specified width is not large enough to contain the number). There is a 24-character limit to the length of the printed text; longer strings will be truncated.
Examples:
Suppose the text is "76/12/25 23:11:11". Then
set format x # defaults to "12/25/76" \n "23:11" set format x "%A, %d %b %Y" # "Saturday, 25 Dec 1976" set format x "%r %D" # "11:11:11 pm 12/25/76"
Suppose the text is "98/07/06 05:04:03". Then
set format x "%1y/%2m/%3d %01H:%02M:%03S" # "98/ 7/ 6 5:04:003"