On 07/05/2026 18:49, Dan Jacobson wrote:
"PB" == Pádraig Brady <[email protected]> writes:
PB> %c '%a %x %X' locale's date and time
That's what I'm trying to avoid.
I'm trying to see real samples, with no intellectual thinking involved.
That particular one is way to long to display,
so I used a more abstract form for it.
PB> %C 20 century; like %Y, except omit last two digits
PB> %d 01 day of month
PB> %D 12/31/99 date (ambiguous); same as %m/%d/%y
PB> %e 1 day of month, space padded; same as %_d
PB> %F 1999-12-31 full date; like %+4Y-%m-%d
PB> %g 99 year of ISO week number (last two digits; 00-99); see %G
PB> %G 1999 year of ISO week number; normally useful only with %V
Also could you just use "now", a random date, not something specially
tinkered so that it is a special date many years ago.
I wanted to use examples that were easily recognizable
to the quantity being displayed, rather than an arbitrary date.
PB> %N 123456789 nanoseconds (000000000..999999999)
Yes, it is nice to know how many digits, but the example becomes less real.
I think that's fine
PB> %p PM locale's equivalent of AM or PM; blank if not known
PB> %P pm like %p, but lower case
PB> %q 4 quarter of year (1..4)
PB> %r 1:11:04 PM locale's 12-hour clock time
PB> %R 23:59 24-hour hour and minute; same as %H:%M
PB> %s 1778169005 seconds since the Epoch (1970-01-01 00:00 UTC)
PB> %S 59 second (00..60)
PB> %t \t a tab
Well that's tinkered too.
I would write
PB> %t "[<- there's a tab (\t) there.]"
I'll keep this aligned with what's done for %n
PB> %:z +04:00 +hh:mm numeric time zone
PB> %::z +04:00:00 +hh:mm:ss numeric time zone
PB> %:::z +04 numeric time zone to necessary precision; with :
I'd put these in a separate section. After the straight alphabet part.
I'll keep these with the main group for now
And be sure to include the one liner script so people can do it
themselves. And be sure it's a real one liner.
A portable one liner could be:
printf $(printf '\\%03o\\n' $(seq 97 122) $(seq 65 90)) | xargs -If date +"%%f
%f"
Though that's a bit obtuse.
Note we had something similar with `dircolors --print-ls-colors`
where we previously had a one liner to display the database.
I'm considering instead we should support date --show-formats
which would generate the above table with the current date/time/locale.
It could also show the %E and %O variants (if different).
It might also show the --iso and --rfc formats too.
cheers,
Padraig