On 05/12/2023 01:41, Greg Wooledge wrote:
unicorn:~$ LC_TIME=en_US.utf8 printf '%(%c)T\n' Mon 04 Dec 2023 01:34:42 PM EST Sadly, you're restricted to the choices offered by your installed locales. If you can't find an installed locale which has an acceptable LC_TIME format, then you can try to roll your own. I went down that road once. It didn't really work out for me. Too many finicky details that simply don't work out in reality.
I think, absence of really flexible time formats may be intentional. At first I was surprised that Intl.DateTimeFormat in JavaScript does not have a method similar to strftime.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormatPerhaps I have noticed rationale reading docs related to the Temporal proposal. Time formats vary greatly across the world. So if a developer fix particular format using % specifiers then the format may be rather strange for users from other countries. It is safer to specify locale and some hints like long/short. In addition, Gregorian calendar is not the only option.
Formats of dates and time are a part of Common Locale Data Repository https://cldr.unicode.org/