Delen via


Jscript Run Time Fix for DST 2007 in United States.

Let me take some time to introduce myself. My name is Titus and I am a SDET in JScript team. Today I am going to blog about the behavior of JScript Date object because of DST rule changes as per Energy Policy 2005 and how to get around the problem.

Introduction

Beginning in 2007, there has been a change in the times when DST will be observed in United States. DST will now start on 2nd Sunday of March, which is three weeks earlier than usual, and will End on 1st Sunday of November, which is one week later than usual.

Below Table gives a broader picture.

DST Start

DST End

Before 2007

1st Sunday of April

Last Sunday of October

Ex for 2006

April 2nd 2006

October 29th 2006

DST Start

DST End

From 2007

2nd Sunday of March

1st Sunday of November

Ex for 2007

March 11th 2007

November 4th 2007

Problem Due to This:

If you create a custom application that uses the JScript Date object, the time is reported incorrectly for dates that are between second Sunday in March and the first Sunday in April, also between Last Sunday of October and First Sunday in November for the year 2007. Instead of the time being reported in daylight time, the time is reported in standard time.

For example, for March 30, 2007, the JScript Date object reports time as Pacific Standard Time instead of Pacific Daylight time.

Resolution:

To get proper Date and Time Values while using Jscript Date Object (or any of its related methods), the following patches have to be applied, and also TZ environment variable needs to be set.

1. Install 2007 time zone update for Microsoft Windows operating systems that are documented in the following Microsoft Knowledge Base articles:

- 933360 August 2007 cumulative time zone updates for Microsoft Windows operating systems

2. Install the C run-time (CRT) update that is documented in the following Microsoft Knowledge Base article:

- 932590 FIX: Windows-based applications that use the TZ environment variable may not work as expected because of changes to DST

3. Install JScript update documented in the following Microsoft knowledge base article.

- 933811 The JScript version 5.6 Date object reports time in standard time instead of in daylight saving time after you apply the updates in Microsoft Knowledge Base articles 928388 and 932590 on a computer that is running Windows XP or Windows Server 2003

- 933812 The JScript version 5.7 Date object reports time in standard time instead of in daylight saving time after you apply the updates in Microsoft Knowledge Base articles 928388 and 932590 on a computer that is running Windows XP or Windows Server 2003

4. Set TZ environment variable value to PST8PDT.

Resources:

Thanks,

Titus

Comments