Reputation: 107
Daylight savings came into effect at 1AM Sunday March 25th 2018 and will again come into effect on 1AM Sunday March 29th in 2019 within my timezone.
I'm aware there is an is_currently_dst flag in sys.time_zone_info however I'm looking to identify the specific point of change its self.
Can this be identified dynamically within SQL server going forward?
Upvotes: 0
Views: 241
Reputation: 28789
Short answer: no. Long answer: this is OS specific and at present SQL Server offers no abstraction over the DST rules beyond the very simple sys.time_zone_info
.
You can grab the time zone info and use a specialized client library to get the adjustment rules. .NET has TimeZoneInfo
, and you could use a CLR function to reflect this info back into SQL Server. There's also third-party support (disclaimer: no experience).
Alternatively, 2016 offers AT TIME ZONE
to do certain calculations, which may or may not be enough for your purposes. It will not allow you to identify the previous change in a straightforward way, but it does allow you to determine if DST was in effect for any particular point (by comparing time zone offsets with a known point).
Upvotes: 1