July 5, 2019 at 11:38 am
Hi All,
I have a question, using sql query can I get the current IST time and current PST time ?
Thanks,
Sam
July 5, 2019 at 11:56 am
I would probably use
SELECT GETDATE() AT TIME ZONE '<Full name of time zone>';
July 5, 2019 at 1:19 pm
Hi All, I have a question, using sql query can I get the current IST time and current PST time ? Thanks, Sam
There are multiple time zones known as IST. Which one are you looking for?
To the best of my knowledge, SQL has no way of determining DST. You have to maintain a list of when it takes effect, and code for it yourself.
July 5, 2019 at 3:40 pm
Actually, sys.time_zone_info has an is_dst_enabled column you can use here. SQL Server should match this up correctly.
Time zones are tricky, but this might help you:
DECLARE @t DATETIMEOFFSET = SYSDATETIME() AT TIME ZONE 'India Standard Time';
SELECT @t
, @t AT TIME ZONE 'Pacific Standard Time'
July 11, 2019 at 6:34 am
Thank you All.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply