Sunday, March 25, 2012

Daylight Saving Time DST 2007 Problems

I believe my machine is fully patched. The SQL Server believes that it is not yet DST, whereas the windows interface has switched. So what should I do here? (I'm in EST/EDT time zone -- New York City -- commands were run at 1:13 am.)

select current_timestamp,getutcdate()-getdate()

-- --

2007-03-13 00:13:24.843 1900-01-01 05:00:00.000

(1 row(s) affected)

SQL Server gets tim (using all three of these functions) from the Windows OS.

This is a quote from Books Online for getutcdate()-

Returns the datetime value that represents the current UTC time (Coordinated Universal Time or Greenwich Mean Time). The current UTC time is derived from the current local time and the time zone setting in the operating system of the computer on which the instance of Microsoft SQL Server is running.

|||The windows gui gives me the right time. A cmd shell "time/t" command gives me the right time, but the T-SQL I quoted gets the wrong time and all my agent jobs are running an hour late, so something is up here...|||

so, instead of a 5 hour difference between the two you should see a 4 hour difference?

|||Yes. That's right.|||If you go to a cmd prompt and type "time" and open a query window and run "SELECT GETDATE()" Do you get the same hour?

When was the last time you rebooted the server?

It use to be, I don't know if it still works this way, Windows would fudge the Windows clock after DST and would reset the RTC clock when the computer rebooted.

So your RTC could say 1:13pm and Windows would report 2:13pm, until you rebooted.|||We noticed that about 50% of the time the DLS Patch that we applied to Windows 2003 did not update the registry values for daylight and daylight end. We found that the time would update and display correctly on the OS, but anything that capture time via some time/date.dll would be an hour off.

No comments:

Post a Comment