DST offset wrong for southern hemisphere

Topics: Developer Forum
Sep 10, 2009 at 3:23 PM

A while back I reported an issue with DST for southern hemisphere locations. Originally, in version 0.2.30.0, DST start and end dates were reversed. For example, today on Sep 10, 2009, Canberra, Melbourne, Sydney location, which normally has GTM +10:00 would return:

- DST: On (incorrect)
- DST Offset: +01:00 (incorrect)
- DST Starts: 2009-04-05 03:00 (incorrect)
- DST Ends: 2009-10-04 02:00 (incorrect)
- Time Zone Offset from GMT: +10:00 (correct)

The fix, which is the most recent version (0.2.47.0), looks like this:

- DST: Off (correct)
- DST Offset: 00:00 (correct)
- DST Starts: 2009-10-04 02:00 (correct)
- DST Ends: 2009-04-05 03:00 (correct)
- Time Zone Offset from GMT: +11:00 hours (incorrect)

From what I see, this affects all southern hemisphere time zones with DST (fortunately there aren't that many). You may want to be aware of this and correct the wrong values in your code.

Here are PublicDomain.TzTimeZone methods that demonstrate how I get each of the above values. I took these out of my Time Zone test page where I have a lot of additional code, so I haven't tested these raw calls. You may have to replace now with a datetime variable which you explicitly set to local or UTC with DateTime.SpecifyKind(dtVariable, DateTimeKind.Local).

Dim zone As PublicDomain.TzTimeZone
Dim sZone as string
sZone = "Australia/Melbourne"
'sZone = "America/Sao_Paulo"
zone = PublicDomain.TzTimeZone.GetTimeZone(sZone)
'Time Zone Offset from GMT: zone.GetUtcOffset(now)
'DST: zone.IsDaylightSavingTime(now)
'DST Offset: zone.GetDaylightChanges(now.year).Delta.Hours.ToString & ":" & zone.GetDaylightChanges(2009).Delta.Minutes.ToString
'DST Starts: zone.GetDaylightChanges(now.year).Start
'DST Ends: zone.GetDaylightChanges(now.year).End