How does System.TimeZoneInfo.TransitionTime calculate the Week property for a floating daylight savings rule?
Posted on 2008-11-03
I'm busy writing a service that will detect daylight savings change overs and execute code when this change over happens. (for any daylight savings enabled timezone).
I understand that there are two types of transition time rules. Fixed: where Month, Day and Time of day are used for the rule. Floating: where month, week, dayOfWeek and Time of day are used.
I'm having trouble with the way that .net is reporting the Week property for a floating rule.
From what i can see Month 11, week 1, DayOfWeek sunday = the first sunday in November.
If it is the first sunday it reports the week as 1, that i can understand, but if it is the last sunday (forth sunday) it reports 5 but there are only 4 sundays in the month. How does .net calculate the week property?
How do i generate a DateTime using the floating rule properties?
Here is what i was using when i first found this inconsistancy.
The timezone is "(GMT-08:00) Tijuana, Baja California"
DayLight Start DateTime : 05 April 2009 2AM (reports the correct week value)
DayLight End Datetime : 25 October 2009 2AM (reports week 5 ???)