With the help SYSDATETIMEOFFSET we will get the different time
zone at the globe. It is a date function and returns a datetimeoffset value of
the computer on which the instance of SQL Server is running.
DECLARE @local DATETIMEOFFSET = SYSDATETIMEOFFSET()
SELECT SYSDATETIMEOFFSET() as 'CurrentDT-W/Offset'
SELECT SWITCHOFFSET (@local, '-08:00') as 'ConvertedDT-W/Offset'
SELECT SYSDATETIMEOFFSET() GetCurrentOffSet;
SELECT TODATETIMEOFFSET(@local, '+08:00') 'Singapore Standard Time
and W.Australia Standard Time and Taiei Standard Time’';
SELECT TODATETIMEOFFSET(@local, '+09:00') 'Ulaanbaatar Standard
time';
SELECT TODATETIMEOFFSET(@local, '+08:30') 'North Korea Standard
Time';
SELECT TODATETIMEOFFSET(@local, '+08:45') 'Aus Central W. Standard
Time';
SELECT TODATETIMEOFFSET(@local, '+09:00') 'Tokyo Standard Time';
SELECT TODATETIMEOFFSET(@local, '-04:00') 'GetCurrentOffSet-4';
SELECT TODATETIMEOFFSET(@local, '-02:00') 'GetCurrentOffSet-2';
SELECT TODATETIMEOFFSET(@local, '+00:00') 'GetCurrentOffSet+0';
SELECT TODATETIMEOFFSET(@local, '+02:00') 'GetCurrentOffSet+2';
SELECT TODATETIMEOFFSET(@local, '+04:00') 'GetCurrentOffSet+4';
|
See the output
No comments:
Post a Comment
If you have any doubt, please let me know.