My server is in California, and ATM returns time with a PDT offset: -07:00. I can convert this to UTC easily enough:
SELECT SWITCHOFFSET(SYSDATETIMEOFFSET(), '+00:00')
However, what I really want is Western European Time (AKA London Time), which at the moment is +00:00, but in a couple weeks will be +01:00. I'd rather not build in the logic for when different parts of the world enter and leave daylight saving time.
MS SQL doesn't support time zone names as a parameter in SWITCHOFFSET()
. Is there some trick to getting a "real world" time zone, as opposed to merely an offset? This topic has been surprisingly difficult to Google; there are a zillion articles about how DATETIMEOFFSET
is now available, but very little about how to take advantage of it.
Here's the MS article on SWITCHOFFSET()
. I see nothing about getting to actual local time zones.
There's a pretty good question about this for .NET here, but I'd like to do this without setting up CLR.