Time zones: the localized GMT formats

Jon Zeppieri zeppieri at gmail.com
Thu Mar 12 19:22:15 CDT 2015


Is there a better place to direct questions like this? -J

On Wed, Mar 11, 2015 at 12:27 AM, Jon Zeppieri <zeppieri at gmail.com> wrote:
> It's not clear to me how to determine the concrete format to use for
> the localized GMT time zone formats. The description of these formats
> begins:
> ===
> Localized GMT format: A constant, specific offset from GMT (or UTC),
> which may be in a translated form. There are two styles for this. The
> first is used when there is an explicit non-zero offset from GMT; this
> style is specified by the <gmtFormat> element and <hourFormat>
> element. The long format always uses 2-digit hours field and minutes
> field, with optional 2-digit seconds field. The short format is
> intended for the shortest representation and uses hour fields without
> leading zero, with optional 2-digit minutes and seconds fields. The
> digits used for hours, minutes and seconds fields in this format are
> the locale's default decimal digits:
> ===
>
> While this is suggestive, it leaves a lot unsaid. The <hourFormat> for
> "en" is "+HH:mm;-HH:mm". This looks appropriate to use for the long
> localized format -- except that it's not obvious what to do with the
> "optional 2-digit seconds field" mentioned above.
>
> More troubling, however, is that in the general case, I don't know how
> to generate the short form using this data. While it's easy to strip
> out the "mm" portion of this when it's not needed, I don't know, in
> general, how to deal with separators or possibly literal portions of
> this pattern that should be removed along with the "mm." For example,
> in this particular case, I know that I'd have to remove the colon
> before the minute pattern, but I imagine that a locale could use
> something like: "HH 'hours', mm 'minutes'," and I would not know to
> remove the entirety of ", mm 'minutes'" without treating it as a
> special case.
>
> Is there a way to generate the short format for an arbitrary locale?
> Also, how are optional seconds supposed to be handled?
>
> - Jon


More information about the CLDR-Users mailing list