Determining remote daylight saving time in sql server

I want to determine if daylight saving time is turned on, but in a region other than where my server is located.

My problem is that I want to check London daylight saving time, and my server is in Canada; Can I find daylight saving time in a different time zone?

+5
source share
4 answers

You need to expand the DST table and see the DST time for the region you want. DSTs are published by various organizations and are updated periodically. What you need to understand is that DST cannot be determined by an algorithm, it can only be searched for in accordance with different legislative bodies for different regions and often changed. For example, here is the current 2013 DST table . Maintaining your application. The current DST statistics table will be a recurring task for your application.

+5
source

It would be best to use one of two common Time Zone databases .

, , ( ) Microsoft TimeZone SQL Server, TimeZoneInfo [HostProtection] MayLeakOnAbort true.

, NodaTime. SQL CLR .

, .

UPDATE

SQL CLR , .

, .

0

Heres IsDST SQL Server...

CAST ((DATEPART (month, DATEADD (week, -1, <DateTime>)) + 2)% 13/5 AS bit) AS IsDST

Yield 0 for standard time November 8 - March 7 and 1 for daytime March 8 - November 7.

0
source

On Sql 2016 server:

Now that sys.time_zone_info you can ask if a specific time zone is currently in DST.

select * from sys.time_zone_info

Here is an example result

name                    current_utc_offset    is_currently_dst
Aleutian Standard Time  -09:00                1
Hawaiian Standard Time  -10:00                0
Marquesas Standard Time -09:30                0
Alaskan Standard Time   -08:00                1
-1
source

All Articles