I’m showing times on RESTXQ generated pages that need to be adjusted for a particular time zone. Doing the time zone adjustment is easy enough but I realized that knowing whether or not a given time zone should be standard or daylight time is a challenge not directly addressed by the XQuery time functions.
So my question: does anyone have a technique for determining if a given time zone or region is using DST?
Of course I can hard-code some sort of DST calendar for the time zones I know I need (U.S. time zones, European Central Time, India Standard Time) but it seemed like there ought to be a more general solution somewhere.
My server is running on Linux but is developed and tested on macOS.
Thanks,
Eliot
_____________________________________________ Eliot Kimber Sr Staff Content Engineer O: 512 554 9368 M: 512 554 9368 servicenow.comhttps://www.servicenow.com LinkedInhttps://www.linkedin.com/company/servicenow | Twitterhttps://twitter.com/servicenow | YouTubehttps://www.youtube.com/user/servicenowinc | Facebookhttps://www.facebook.com/servicenow
On Tue, 2022-06-28 at 16:12 +0000, Eliot Kimber wrote:
So my question: does anyone have a technique for determining if a given time zone or region is using DST?
Is currently using? The transition dates are in at least some cases political, and set by parliaments or whatever each year.
My server is running on Linux but is developed and tested on macOS.
You could run the system command, e.g. LC_TIME="fc_CA.UTF-8" date which here returns mar 28 jun 2022 17:38:41 EDT
but that depends on having the locale installed and up to date.
We also don't have in XQuery or XSLT or Xpath a way to interpret "The thurd sunday in March" which is when, for example, Cuba switches.
I'm not sure if tehre's a machine-readable definitive list somewhere but seems possible...
basex-talk@mailman.uni-konstanz.de