Subject: Re: Locale setting for ISO 8601 date formats
To: Brian de Alwis <bsd@cs.ubc.ca>
From: Greg A. Woods <woods@weird.com>
List: netbsd-users
Date: 12/03/2003 15:24:06
[ On Tuesday, December 2, 2003 at 20:39:12 (-0800), Brian de Alwis wrote: ]
> Subject: Locale setting for ISO 8601 date formats
>
> This may be a stupid question, but I've tried to figure this
> out on several occasions with no success. I have an application
> that uses strftime(3) to display dates using the locale's setting.
> But this comes out as MM/DD/YY. I'd really rather use the ISO 8601
> format, YY/MM/DD.
The date portion of true ISO 8601 format is:
YYYY-MM-DD
:-)
> What do I need to set LC_TIME to accomplish this?
> Or do I need to configure and install my own locale?
If the application is using "%c" then you should see the date and time
in the "locale's appropriate representation".
If the application is using "%x" then you should see the date in the
"locale's appropriate representation".
However if the application is not using "%c" or "%x" then changing the
locale specifications in the environment will have no effect at all.
Am I right to assume you don't have control over the source code for
this particular application?
The best solution to force ISO-8601 format would be to use "%F", or
alternately maybe the "%Y/%m/%d" variant and thus avoid locale specific
representations.
--
Greg A. Woods
+1 416 218-0098 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>