October 16, 2019 at 3:53 pm
hello
someone aware how to convert getdate() to at time zone EASTERN TIME
can you help me please
October 16, 2019 at 6:46 pm
SELECT getdate() AT TIME ZONE 'Eastern Standard Time';
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
October 16, 2019 at 6:46 pm
You should be using SYSDATETIMEOFFSET()
if you are going to be switching time zones.
SELECT GETDATETIMEOFFSET() AT TIME ZONE 'US Eastern Standard Time'
If you need to, you can then convert that to a DATETIME value.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
October 16, 2019 at 6:53 pm
SELECT getdate() AT TIME ZONE 'Eastern Standard Time';
This will only work if the local time IS Eastern Standard Time. If the input date doesn't already have an offset, it assumes that the input date is the value at the target time zone rather than the value at the local time zone that needs to be adjusted to the target time zone.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply