0

I am trying to convert from UTC to Eastern Standard Time. But the code below is not producing the result that I expect.

SELECT 
    GETUTCDATE() AS UTC_Date,  --original datetime value
    GETUTCDATE() AT TIME ZONE 'Eastern Standard Time' AS ETZ

The result is

UTC_Date = 2022-01-16 01:15:39.920
ETZ =2022-01-16 01:15:39.920 -05:00

How can I get a simple date time with the offset applied instead of just added on to the end of the string?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
zapdbf
  • 107
  • 6
  • ok, thanks that worked. – zapdbf Jan 16 '22 at 01:33
  • @lptr You've been asked this already: if you have an answer please post an answer instead of a comment. You can always make it a community wiki if you don't want it associated with you. – Charlieface Jan 16 '22 at 03:15
  • Does this answer your question? [Convert Datetime column from UTC to local time in select statement](https://stackoverflow.com/questions/8038744/convert-datetime-column-from-utc-to-local-time-in-select-statement) Second answer there uses the above syntax for SQL Server 2016+ – Charlieface Jan 16 '22 at 03:16
  • yes it does..... – zapdbf Jan 16 '22 at 13:43

0 Answers0