John Tamplin jat at
Fri May 27 09:58:26 PDT 2011

On Fri, May 27, 2011 at 12:21 PM, Marc Harter <wavded at> wrote:

> > Note that it is rarely useful to format with a fixed pattern, because
> > different locales have different norms for ordering of the fields,
> > separators, etc.
> By fixed pattern do you mean like  d.format('YY/mm/dd')?  If so,
> doesn't that allow for more expressive power?

To illustrate the problem, consider formatting a date next week with
"M/d/y", giving 6/1/2011.  US readers will understand that readily.
 However, if a European user sees that, they will interpret it as if it were
"d/M/y", and they will think it is in January.  Also, many locales have
different separators for the portions of the date, or insert additional
words in the longer formats, which won't be present if you just used a fixed
format pattern.

Instead, you should use a skeleton pattern of "Mdy" saying that you want a
format with numeric values for month day and year.  Then, you get the proper
format for the locale your user is running your app in.  Even better, though
more restrictive, is to use a predefined format where experts in each locale
have said this is a good "short" date format for that locale, since there
are different conventions.

For examples from CLDR, see:


Certainly, there are cases where you do want a fixed format (and in fact you
don't want localized names, but rather the English month/day names), such as
when formatting an RFC2822 date, and in those cases you do want to be able
to use a fixed format string.

John A. Tamplin
Software Engineer (GWT), Google
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list