Michael Kay wrote:
> ZN in format-time() is rather a nonsense, I'm afraid. There's simply not
> enough information in an XML Schema dateTime (and even less in a time) to
> know what civil time zone the time is in. Because it's in the spec, Saxon
> makes a crude guess for a number of commonly-used timezones in North America
> and Europe, but it's not really a sensible facility to use.
but in conjunction with place, it makes much more sense, as any given
place has (afaict) a limited amount of timezones. Though I agree about
the 'nonsense' bit, looking at the resources from my previous post, I
can see quite an amount of timezone names connected to each timezone offset.
> In the next release I'm changing it to be a bit more intelligent; it will be
> driven by the country argument (5th argument)
> <snip />
> but I think it's the best I can do.
it would be great to see that feature added!
> timezone names make little sense because the same
> names (like AST) are used with different meanings in different countries, so
> it's better to use offsets.
I agree. But when you display a date to end users, especially in any
given country, it will make sense to them when they recognize the name.
For instance, currently in Europe mainland we are in daylight savings,
as a result, the guess that Saxon makes is off by one hour. I.e., the
current-date is said to be in EEST, instead of CEST for The Netherlands
(and I bet the same is true for France, Spain etc).
> This facility was I think designed into the spec
> primarily with North American users in mind; they and a few other places
> like Russia and Australia use multiple timezones within a single country.
Indeed, and I got curious and looked it up: countries divided by
timezones are: Canada, Mexico, Brazil, US, Greenland, Australia,
Indonesia, Russia, Kazackstan.
> I've tested this case on the new Saxon code and
> format-dateTime(xs:dateTime('2007-09-21T12:00:00+05:30'), '[ZN]', (), (),
> correctly returns "IST". You can also get the Olsen timezone name by
> requesting a minimum length of 6 or more, so
> format-dateTime(xs:dateTime('2007-09-21T12:00:00+05:30'), '[ZN,6-*]', (),
> (), 'in')
> returns "Asia/Calcutta".
Very nice! I love it when systems get truly (for the extend reasonably
possible) international. I think the design for using the country name
is just what it is about for. I read somewhere that the JVM is using the
Olson database, which should mean that it has just about the most
accurate information of any given place/moment currently possible.
Thanks & cheers,
-- Abel Braaksma