SQL Server Time Zone

In SQL Server 2008 R2, if I do this:

select SYSDATETIMEOFFSET() 

I am returning to GMT -6.

Windows TimeZone running SQL Server is set to GMT -7.

Any ideas why there is a difference? Is there somewhere in SQL Server I need to install TimeZone?

+4
source share
2 answers

I would suggest that this is due to the fact that the daylight function is active. Your time zone is officially called "GMT-7", which means that usually (not in the summer time), your time is 7 hours earlier than GMT. But during summer time, this time is adjusted (usually by an hour, but may differ by time zone). Therefore, if you are currently in daylight saving time, even if you are in the GMT-7 time zone, your watch is currently only available at GMT-6 (6 hours earlier than GMT). I suspect SYSDATETIMEOFFSET () is telling you your actual GMT offset at the moment, unlike your usual โ€œclockwiseโ€ offset from GMT.

+3
source

MSDN says that SQL Server uses the Windows settings:

SQL Server 2012 retrieves date and time values โ€‹โ€‹using the GetSystemTimeAsFileTime () Windows API.

Perhaps you need to restart the SQL Server service after changing the time zone?

0
source

All Articles