It would be great to have the option to display a date with its
ordinal suffix, e.g. 22nd August, especially now that these
display options carry through to the panel clock in GUIs such as
I raised this possibility with the coreutils team but was advised that they are
reluctant to add format modifiers where no precedent exists in the C libraries.
Not going to happen. This doesn't work well (at all?) with
internationalization. You could create your own locale with the alt_digits
appropriately defined and then %Od or so to print the day. Not sure this works,
though, nobody tried that.
I suggest reopening this bug instead of filing a similar one which I was going to do.
As suggested in this bug report: https://bugzilla.gnome.org/show_bug.cgi?id=768192 there is a broader need for another way to format the day of the month. I hesitate to use the word "alternative" because someone might say that the alternative format specifiers already exist, for example "%Od" (this is for alternative digits, for example Roman or Eastern Arabic, also alternative digits are for all numeric outputs, not just days) or "%Ed" (unsupported, I'm not sure what would it mean). The output would be:
- the ordinal day number as required in English (1st, 2nd, …) or Friulian (1ⁿ, 2, 3,…) or maybe in more languages,
- optionally preceded by a required preposition (Friulian: al 1ⁿ, ai 2, ai 3…),
- or anything else, as required by specific locales.
Other languages would output a regular decimal number, or would rather not use this new format specifier.
Browsing the stftime(3) man page I can see that the nearest unused format specifier is "%f". So, for example:
- "%B %f" would output "April 14th" (or "April 1st") in English;
- "%f di %B" would output "ai 14 di Avrîl (or "al 1ⁿ di Avrîl) in Friulian.
A similar solution is here: https://github.com/samsonjs/strftime and it introduces "%o" but says explicitly that it outputs ordinal numbers (while here I say it can be ordinal or anything else, as required by a specific language) and it is implemented for English only.
This fix is also needed for my locale (Scottish Gaelic) and would follow the same pattern as English:
1 = 1d
2 = 2na
3 = 3s
Note that the CLDR does not support coding this either, so the CLDR data isn't 100% reliable here.