On 09/05/2026 00:50, Bruno Haible via GNU coreutils Bug Reports wrote:
Pádraig Brady wrote:
FORMAT  Example    Description

   %%    %           a literal %
   %a    Sun         locale's abbreviated weekday name
   %A    Sunday      locale's full weekday name
   %b    Mar         locale's abbreviated month name
   %B    March       locale's full month name
   %c    '%a %x %X'  locale's date and time
   %C    20          century; like %Y, except omit last two digits
   %d    01          day of month
   %D    12/31/99    date (ambiguous); same as %m/%d/%y
   %e     1          day of month, space padded; same as %_d
   %F    1999-12-31  full date; like %+4Y-%m-%d
   %g    99          year of ISO week number (last two digits; 00-99); see %G
   %G    1999        year of ISO week number; normally useful only with %V
   %h    Mar         same as %b
   %H    23          hour (00..23)
   %I    01          hour (01..12)
   %j    365         day of year (001..366)
   %k     8          hour, space padded ( 0..23); same as %_H
   %l     9          hour, space padded ( 1..12); same as %_I
   %m    12          month (01..12)
   %M    59          minute (00..59)
   %n    \n          a newline
   %N    123456789   nanoseconds (000000000..999999999)
   %p    PM          locale's equivalent of AM or PM; blank if not known
   %P    pm          like %p, but lower case
   %q    4           quarter of year (1..4)
   %r    1:11:04 PM  locale's 12-hour clock time
   %R    23:59       24-hour hour and minute; same as %H:%M
   %s    1778169005  seconds since the Epoch (1970-01-01 00:00 UTC)
   %S    59          second (00..60)
   %t    \t          a tab
   %T    23:59:59    time; same as %H:%M:%S
   %u    7           day of week (1..7); 1 is Monday
   %U    52          week number of year; Sunday as first day of week (00..53)
   %V    52          ISO week number; Monday as first day of week (01..53)
   %W    52          week number of year; Monday as first day of week (00..53)
   %w    6           day of week (0..6); 0 is Sunday
   %x    12/31/99    locale's date (can be ambiguous)
   %X    23:59:59    locale's time representation
   %y    99          year (last two digits; 00..99)
   %Y    1999        year
   %z     +0400      +hhmm numeric time zone
   %:z    +04:00     +hh:mm numeric time zone
   %::z   +04:00:00  +hh:mm:ss numeric time zone
   %:::z  +04        numeric time zone to necessary precision; with :
   %Z     EDT        alphabetic time zone abbreviation

That's too many lines to search for. As a user, typically I ask:
   1) I have a day to display; which directive can I use for it?
   2) I have a time to display; which directive can I use for it?

Accordingly, I suggest to split this table into several smaller ones,
namely one for each of:
   - literal characters,
   - date
   - time
   - date and time
   - time zone
   - nanosecond
(similar to what I did in gnulib/lib/strftime.h).
Yes I suppose alphabetic is arbitrary.
I.e. users generally want to know "what letter corresponds to ...",
not "what corresponds to letter .".

cheers,
Padraig



Reply via email to