Forum Discussion
Change the timezone for date/time - Arizona
- Apr 02, 2025
If the number 1704228 in db shows time '1/2/2024 1:55:05 PM' in the UI and the time is Arizona Time, then the number stored in db must be an UTC timestamp. Code below will make the conversion
SELECT FORMAT(DATEADD(MILLISECOND, PARSE(RIGHT(Completed_Date, 3) AS INT), DATEADD(SECOND, PARSE(LEFT(Completed_Date, 10) AS INT), CAST('1970-01-01' AS DATETIME2)))
AT TIME ZONE 'UTC' AT TIME ZONE 'US Mountain Standard Time', 'MM/dd/yy hh:mm:ss tt', 'en-us' )
We are in the Pacific Time Zone now...
It's CRAZY, I know! LOL
In Arizona, you have to use 'US Mountain Standard Time', it need not change time with the season. 'Mountain Standard Time' is used by other State with DST.
Unfortunately, there is no Arizona Time Zone for MS SQL.
Fortunately, the name of Arizona Time Zone in MS SQL is 'US Mountain Standard Time'
- Hopeisgood1Apr 01, 2025Copper Contributor
Ahhh! I did not know that!!! Thank you for that info!~ Looking at other replies - give me a bit