Page 1 of 1

How to determine the current TimeZone and DST Rule.

PostPosted: Tue Mar 07, 2017 3:44 pm
by broadblues
For my current project involving Ical / vcs data I need to create a VTIMEZONE object which is text based data structure containing timezone information expressed as set of rules.

I'm finding hard to locate an API based way to determine the current timezone and rule in place.

Ideally I need the timezone in the IANA style format "Europe/London" etc etc

timezone.library does allow you to determine some info, but not everything.

I can get the *short* timezone name ie GMT / DST , EST / EDT etc (and I need that too) but not the long form.

The daylight savings info you retrieve from timezone.library is in the form of a number seconds since 1978 no rue information can be determined from that even by reverse engineering....

A DST "rule" is typically of the form "2nd sunday in April" "last sunday in October" etc etc.

Timezone data is available in Locale:Timezone in xml format but to make use of that I need to know the timezone country and rule names.

I would expect when setup via locale it might be in the struct Locale but it doesn't appear to be there, and when set via TimeZone there is no API I can see to access that info.

Any ideas?