Re: Show me locale fomats
On Tue, Jun 23, 2009 at 05:17:31PM +0100, Roger Leigh wrote:
> On Tue, Jun 23, 2009 at 06:54:34PM +0300, Dotan Cohen wrote:
> > > by issuing the locale command.
> > >
> >
> > I mean, let's say that I want yyyy-mm-dd date format? What command can
> > I give to show me which locale I must configure to get that format?
>
> Normally you don't need to know. You use strptime(3) to print the
> date and/or time. For example, strptime("%c", ...). The manual
> page will give you the detail.
>
> To get the format string, do:
> locale -k d_fmt
> d_fmt="%d/%m/%y"
> (en_GB)
>
> A list of keywords is found in locale(5).
>
> (I don't know how to get this from within a program using a C
> library interface. Does anyone else have any ideas?)
Appears to be just calling nl_langinfo(3).
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
Reply to: