bug#80974: Add Time conversion specifiers quick reference

Pádraig Brady <[email protected]> Fri, 8 May 2026 20:14:33 +0100
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
On 08/05/2026 05:55, Collin Funk wrote:
> Pádraig 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.
OOK I'll leave `date --show-all-formats` for now.
I've pushed the change to show descriptive examples in --help.

Marking this as done.

cheers,
Padraig