Forum Discussion
Hopeisgood1
Mar 27, 2025Copper Contributor
Change the timezone for date/time - Arizona
Hello, I am in Arizona with no daylight saving. The SQL database I am pulling date/time codes has nightmarish Epoch (INT) fields for the date/time fields and it's in Eastern Time Zone. I figured ...
- 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' )
Hopeisgood1
Mar 31, 2025Copper Contributor
The Eastern time is coming from the Product UI. And when it is updated in the database, it reflects the user input.
Hopeisgood1
Apr 01, 2025Copper Contributor
Actually, I got that backwards. It reflects Arizona time input but the database has it at Eastern time.
My bad!