Re: "The default datetime format for the object’s locale"

[email protected] (N Heinrichs)
Newsgroups perl.datetime
Message-ID <CAEnbRwxOT=+68WWt3zTgWQ2cwem3frgmPd6CsV_5w2_vwJiYpQ@mail.gmail.com>
Short answer: As of DateTime v0.72 on my local machine, %c is not
directly configurable.

A little more info:

%c is hardcoded to use the locale's `datetime_format_default` (search
for "strftime_patterns" in DateTime.pm)

DateTime::Locale::ko does not override 'datetime_format_default'. Nor
does it override 'default_date_format_length', or
'default_time_format_length', both of which default to 'medium' (see
DateTime::Locale::root.)

DT:Loc:ko's "medium" date/time formats are "yyyy\.\ M\.\ d\." and "a\
h\:mm\:ss", which is why you get the output below.

So without modifying/overriding DateTime::Locale::ko, or dropping your
use of %c in favor of a custom formatter, it may be difficult to fix
your problem.

If the locale's definitions for the 'medium' formats are
wrong/outdated (see http://cldr.unicode.org/index/downloads) you could
propose an update to the locale class itself, but I am unsure of the
"official" way to do this.

-Nate

On Wed, Oct 24, 2012 at 2:36 AM, Bill Moseley <[email protected]> wrote:
> We have been using formats %c, %x and %X for localizing dates based on
> Locale.   Mostly works ok, but for Korean we are getting this:
>
> 2012. 10. 18. 오후 4:09:05
>
>
> where (I've been told) we would like this format:
>
> 2012년 10월 22일 월요일 오후 01:44 PDT
>
>
> Is this formatting done in DateTime?   I'm wondering how we can set the
> default format used by %c for a given locale.
>
> In a web app what we are currently doing is
> setting DateTime->DefaultLocale() per request.  The DateTime objects are
> inflated from database rows with DBIC.
>
> --
> Bill Moseley
> [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.