Better Watch Out for New US Daylight Savings Rules on Windows!

January 25, 2007

I have a series of libraries I wrote 5 years ago which handles conversion of daylight savings to and from any time zone world wide.  We use this in our application, Project Insight (http://www.projectinsight.net) and in other projects that we do that deal with dates and times.  

So after spending an entire weekend putting the library together in .NET 1.0 (and all future versions too) I was keenly interested when Congress changed the US daylight savings rules on us.  As soon as it was official I updated my library and didn’t think anything of it after that knowing my libraries did the rules correctly.  I assumed that Windows update would update all our OS’s long before this became a problem.  Boy was that assumption way off base!  I just discovered that hardly any computer in our network has the update for the new daylight savings rules!  Yikes!

To find this out I did some diagnostic tests (see “My Original Diagnostic Test” results below!).  I was disturbed with the results.  My computer did not do the conversion correctly.  I moved my app to other computers and found that they too did not do the conversion correctly!  I did some searches on the web to see if other people had this problem and did not find much about .NET and this problem.

Finally, I did find a KB article from Microsoft that was first posted on 11/21/2006 that deals with this.  It was last updated 2 days ago (1/22/2007).  To me I’m quite alarmed that this updated didn’t make it out until 11/21/2006??!!??  There are probably millions of computers, desktops, servers etc out there in the US that will be converting time incorrectly in Outlook and other applications come 3/11/2007!  I can see it now, a mini Y2K problem is potentially brewing here with totally screwed up dates and times nationwide for the 3 weeks or so before the first weekend in April!

I hope not!

If you want the update you can get it here!

http://support.microsoft.com/kb/928388

other daylight info:

http://www.microsoft.com/windows/timezone/dst2007.mspx 


Also I have built a simple app which you I can send to you (I can’t figure out how to post a download on WordPress I don’t think they allow it) to test whether or not your computer has the update for the daylight rules. The app simply tests the time portion of two dates before and after the conversion takes place to see if you get the same time portions of the two when converted to UTC.   If the times are equal, well you don’t have the update because the offset is the same meaning daylight did not take affect according to your system.  If the time portions are not equal, then you’re lucky and you already have the update! 

My Original Diagnostic Test 

I built a simple windows APP that will takes a date and converts it into UTC using the DateTime.ToUniversalTime() method.

Old Daylight Rules (2006 and Before)
Daylight savings in the US springs forward one hour at 2:00 AM on the first Sunday of April.

New Daylight Rules (2007 and After)
Daylight savings in the US springs forward one hour at 2:00 AM on the second Sunday of April.

I have a simple windows APP that takes the date you pick plus your current local time and calls the following code:

DateTime date = this.dateTimePicker1.Value;

MessageBox.Show(date.ToUniversalTime().ToString()); 

System In PST with Daylight On As of 1/24/2007 OLD RULES – I GET THIS

3/10/2006 8:55 PM PST converts to 3/11/2006 4:55 AM (before Second Sunday of March)

3/13/2006 8:55 PM PST converts to 3/14/2006 4:55 AM (after Second Sunday of March)

4/1/2006 8:55 PM PST converts to 4/2/2006 4:55 AM (before the first Sunday of April)

4/3/2006 8:55 PM PDT converts to 4/4/2006 3:55 AM (after the first Sunday of April)

These appear to be correct under the old rules.

NEW RULES – I GET THIS 3/9/2007 8:55 PM PST converts to 3/10/2007 4:55 AM (before second Sunday of March)

3/12/2007 8:55 PM PDT converts to 3/13/2007 4:55 AM (after second Sunday of March)

THIS IS INCORRECT!


I expect this: 3/12/2007 8:55 PM PDT converting to 3/13/2007 3:55 AM (after second Sunday of March) 
To continue the test:3/31/2007 8:55 PM PDT converts to 4/1/2007 4:55 AM (before first Sunday of April)THIS IS INCORRECT! I expect this: 3/31/2007 8:55 PM PDT converts to 4/1/2007 3:55 AM (before first Sunday of April) 

To continue the test:

4/2/2007 8:55 PM PDT converts to 4/3/2007 3:55 AM (after first Sunday of April)

THIS IS CORRECT! 

Advertisements

7 Responses to “Better Watch Out for New US Daylight Savings Rules on Windows!”

  1. Matt Says:

    You mentioned a program that compares the times. Is this written in VB, by any chance? I have been searching for a tool to do that in VB for 2 days now. I need to see if the patch worked accross all of our clients.


  2. I am sorry it is a .NET version. Do you still want it? It may be a little late. I didn’t see your comment on this blog until today.

    Sorry about that. Let me know if you still want the conversion tester.

  3. Marinkina Says:

    Пора переименовать блог, присвоив название связанное с доменами 🙂 может хватит про них?

  4. Gavrilin Says:

    Качество друзей тоже надо учитывать. Дональд Трамп, например, на двадцатку потянет.

  5. Cederash Says:

    Хм… Как раз на эту тему думал, а тут такой пост шикарный, спасибо!

  6. Avertedd Says:

    Занятно. Подпишусь-ка я на RSS пожалуй


  7. i wanna download this song…how can i download this song..help plz… Come on http://tropaadet.dk/mosleybond5257081845


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: