Custom locale to use ISO 8601 date format

A.J. Kehoe IV (Nanoman) nanoman at nanoman.ca
Sun Jun 7 16:29:17 UTC 2015


andrew clarke wrote:
>On Sun 2015-06-07 10:42:32 UTC-0400, A.J. Kehoe IV (Nanoman) (nanoman at nanoman.ca) wrote:
>
>> >Here in Australia the general population uses the British DD/MM/YY
>> >format for representing dates, eg. today is 07/06/15, and the
>> >en_AU.UTF-8 locale in FreeBSD 10.1 honours that:
>> >
>> >lrwxr-xr-x  1 root  wheel  22 17 Feb  2011 /usr/share/locale/en_AU.UTF-8/LC_TIME -> ../en_GB.UTF-8/LC_TIME
>> >
>> >However I wanted programs to use the ISO 8601 YYYY-MM-DD date format
>> >(2015-06-07) instead. To do this in Linux, the general method seems to
>> >set LC_TIME=en_DK.utf8, but FreeBSD has no locale by that name.
>>
>> [...]
>>
>> Thanks for sharing your patch, Andrew!  Personally, I wish everybody
>> would adopt ISO 8601, or even ISO 2014, which was standardized twelve
>> years earlier in the year 1976.
>
>I'd like to see that too, I'm not holding my breath. Maybe after the US
>moves to metric... ;-)

But then visitors to the United States would feel less like they're visiting a foreign country!  And the imperial to metric conversion app on my mobile telephone would become less useful.

>I'm not suggesting en_AU.*/LC_TIME be changed system-wide. The patch
>just works for me locally and I'm fine with that.

My understanding is that the Australian government hasn't adopted ISO 8601, so I wouldn't suggest this either.

>> Canada uses ISO 8601, but this isn't reflected in FreeBSD's en_CA
>> locale, so I submitted this patch:
>>
>> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=200079
>
>That's encouraging to hear. I think you'll need to provide a
>better source than Wikipedia though.

You're right.  Canada's official time is defined by National Research Council Canada.  They recommend ISO 8601:

http://www.nrc-cnrc.gc.ca/eng/services/time/index.html

http://www.nrc-cnrc.gc.ca/eng/services/time/faq/#Q8

>Also, obviously what the standards association has adopted and what's
>actually used by the general public can be two different things.
>System locales should probably err on the side of what is already
>being used. Of course what is being used can also be dictated by the
>system locale, so it's a bit chicken-and-egg really.
>
>And all of this assumes the programs you use honour your chosen
>locale. Some apps blindly ignore it, and some have their own setting
>for the date/time format, with the pros and cons of doing that.

I agree.  Here's an example that may never be adopted:

http://www.ietf.org/rfc/rfc2550.txt

>> After somebody commits this patch (or a patch that does something
>> similar), you could use en_CA instead of having to manually patch
>> every system you maintain.
>
>I could, but I'll be doing the latter since it means I'll always have
>complete control over my locale. Plus I only maintain a couple of FreeBSD
>systems where locale really matters to me on a daily basis. A once-off
>rsync of $HOME/locale/ is no big deal.

Still, it would be nice to be able to change only LC_TIME if you're in a country that doesn't use ISO 8601.  Fortunately for me, all the systems I'm responsible for are in Canada, so I wouldn't have to do anything other than get this patch committed.

-- 
A.J. Kehoe IV (Nanoman)     |  /"\  ASCII Ribbon Campaign
Nanoman's Company           |  \ /   - No HTML/RTF in E-mail
E-mail: nanoman at nanoman.ca  |   X    - No proprietary attachments
WWW: http://www.nanoman.ca/ |  / \   - Respect for open standards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3924 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20150607/b94d16d6/attachment.bin>


More information about the freebsd-questions mailing list