bug#80974: Add Time conversion specifiers quick reference
Collin Funk <[email protected]> Thu, 07 May 2026 21:55:48 -0700
| Newsgroups | gmane.comp.gnu.core-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
P=C3=A1draig Brady <[email protected]> writes: >> 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. My concern with a one liner or table of examples is that it risks being misleading for, in my opinion, very little benefit. An easy example is %H and %I which look the same for half of day: $ for spec in H I; do date -d 12:00 +%$spec; done 12 12 $ for spec in H I; do date -d 13:00 +%$spec; done 13 01 The --help output and info page explanations are fairly short and adequate enough that one is unlikely to pick the incorrect specifier. Collin