Re: Formatting dates according to the region




On Mon, Apr 16, 2012 at 12:13 PM, Michael Cronenworth
<mike cchtml com> wrote:
Look at the documentation for g_date_time_format(). You will find
the other format specifiers that you want. %a, %A, %b, %B, and %c
look helpful for you.

Thanks for your suggestion, but the trouble I have with those is I
would still need to make assumptions about the order each part comes
in, and the way they're presented, in a full date. I guess what I'm
looking for is a repository of complete date formats that have already
been localized, which is what g_date_time_format("%x") feels like but
only with a particularly prickly format.

Dylan

If you are on a reasonably up to date GNU libc based system (ie Linux),
then at least usually %c of strftime() works. (man strftime).
The runtime logic is based around the environment variables (TZ), so
testing is required to make sure you are getting the results you want
in gnome or any other desktop environment. The portability of this is
limited though. 

On windows the libc time routines are not only severely broken
(anything to do with historical time for instance) in all versions, but
broken in different ways. To a limited extent, some measure of locale
configurability can be achieved with the winapi. 

I haven't made it to exploring this topic on osx and others.


---
www.thomasstover.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]