coreutils: Date conversion specifiers
1
1 21.1.2 Date conversion specifiers
1 ---------------------------------
1
1 ‘date’ conversion specifiers related to dates.
1
1 ‘%a’
1 locale’s abbreviated weekday name (e.g., ‘Sun’)
1 ‘%A’
1 locale’s full weekday name, variable length (e.g., ‘Sunday’)
1 ‘%b’
1 locale’s abbreviated month name (e.g., ‘Jan’)
1 ‘%B’
1 locale’s full month name, variable length (e.g., ‘January’)
1 ‘%c’
1 locale’s date and time (e.g., ‘Thu Mar 3 23:05:25 2005’)
1 ‘%C’
1 century. This is like ‘%Y’, except the last two digits are
1 omitted. For example, it is ‘20’ if ‘%Y’ is ‘2000’, and is ‘-0’ if
1 ‘%Y’ is ‘-001’. It is normally at least two characters, but it may
1 be more.
1 ‘%d’
1 day of month (e.g., ‘01’)
1 ‘%D’
1 date; same as ‘%m/%d/%y’
1 ‘%e’
1 day of month, space padded; same as ‘%_d’
1 ‘%F’
1 full date in ISO 8601 format; same as ‘%Y-%m-%d’. This is a good
1 choice for a date format, as it is standard and is easy to sort in
1 the usual case where years are in the range 0000...9999.
1 ‘%g’
1 year corresponding to the ISO week number, but without the century
1 (range ‘00’ through ‘99’). This has the same format and value as
1 ‘%y’, except that if the ISO week number (see ‘%V’) belongs to the
1 previous or next year, that year is used instead.
1 ‘%G’
1 year corresponding to the ISO week number. This has the same
1 format and value as ‘%Y’, except that if the ISO week number (see
1 ‘%V’) belongs to the previous or next year, that year is used
1 instead. It is normally useful only if ‘%V’ is also used; for
1 example, the format ‘%G-%m-%d’ is probably a mistake, since it
1 combines the ISO week number year with the conventional month and
1 day.
1 ‘%h’
1 same as ‘%b’
1 ‘%j’
1 day of year (‘001’...‘366’)
1 ‘%m’
1 month (‘01’...‘12’)
1 ‘%q’
1 quarter of year (‘1’...‘4’)
1 ‘%u’
1 day of week (‘1’...‘7’) with ‘1’ corresponding to Monday
1 ‘%U’
1 week number of year, with Sunday as the first day of the week
1 (‘00’...‘53’). Days in a new year preceding the first Sunday are
1 in week zero.
1 ‘%V’
1 ISO week number, that is, the week number of year, with Monday as
1 the first day of the week (‘01’...‘53’). If the week containing
1 January 1 has four or more days in the new year, then it is
1 considered week 1; otherwise, it is week 53 of the previous year,
1 and the next week is week 1. (See the ISO 8601 standard.)
1 ‘%w’
1 day of week (‘0’...‘6’) with 0 corresponding to Sunday
1 ‘%W’
1 week number of year, with Monday as first day of week
1 (‘00’...‘53’). Days in a new year preceding the first Monday are
1 in week zero.
1 ‘%x’
1 locale’s date representation (e.g., ‘12/31/99’)
1 ‘%y’
1 last two digits of year (‘00’...‘99’)
1 ‘%Y’
1 year. This is normally at least four characters, but it may be
1 more. Year ‘0000’ precedes year ‘0001’, and year ‘-001’ precedes
1 year ‘0000’.
1