tags:

views:

128

answers:

5

Using C# (the .NET framework), I'm looping through all the TimeZones and their AdjustmentRules... and for "Mauritius Standard Time" {(GMT+04:00) Port Louis)} - the adjustment rule is as follows:

IsFixed = false;
DaylightTransitionStart.Month = 10;
DaylightTransitionEnd.Month = 1;

From what I understand, 'IsFixed=false' means that I do not use the "StartDate" and "EndDate" fields... but rather, I need to use the DaylightTransitionStart and End to dynamically determine if the time is in daylight time or not.

THE PROBLEM here is that, for about 30 transition rules, the "StartMonth" is AFTER the "EndMonth"

How can DaylightSavingsTime start in 'October 2008' and end in 'January 2008'?

Please help me to understand this... once I get past this hurdle, I should have a complete "convert any time to and from UTC with any time zone for all history" SQL function written.

+5  A: 

A period of time cannot logically end before it starts, but perhaps you're assuming that these months refer to months of the same year when in fact OCT might be in 2008 but JAN is in 2009.

Think of it as a circularly-linked-list.

The DaylightTime class uses a DateTime for both start and end of the daylight-saving period, hence both specify a year.

Ed Guiness
This is what I was thinking as well, but I'm hoping someone has a definite answer.
Timothy Khouri
Though a lot of people gave this sort of answer... this one has the most 'definite' feel about it - so, you win! Thanks for the input.
Timothy Khouri
+4  A: 

Wouldn't this be the case for countries south of the Equator?

njplumridge
Indeed it would.
Richard
+1  A: 

Two different years. e.g. start year 09 end year 10

Tomas
+2  A: 

could be in the southern hemisphere, DST starts in october and ends in march in some parts of Australia

yx
+3  A: 

Theres this thing called the southern hemisphere. Maybe you've heard of it.

In Australia daylight savings starts around October and ends around March (in the states that have it).

cletus
Southern hemisphere... is that possibly ... below the Northern hemisphere? - BTW, the question is a technical one... how can I (in code) determine the true "start" and "end".
Timothy Khouri
And that is the technical reason: if you're modelling daylight savings ranges just as a number for month then start 10, end 3 is the way to do it and it's not a large leap to the year ticking over rather than it being before.
cletus
@Timothy Technically the southern hemisphere isn't below the northern hemisphere, it's just that it is conventionally depicted this way.
Patrick McDonald
Your comment is much better than your "answer". If you actually read the question you would notice that "I" am not "modeling daylight savings ranges", but rather Microsoft is (in the ".Net Framework"). So my question was a "technical one" (meaning - about code), and your answer was a "geographic one" (meaning, something about Australia).
Timothy Khouri
@Patrick - My use of the term "below" is in conjunction with the term "Southern"... it was not meant to be an astro-physiological dogma of which way is "up" :) ... OK, back to work for me!
Timothy Khouri
@Timothy: actually my answer is borne of a frustration with an overly pervasive "US is the world" attitude.
cletus
I can appreciate that... but my desire is to obviously be able to handle all TimeZones... so my question was basically "how do I do that... what I'm getting from MS seems weird".
Timothy Khouri