SELECT CONVERT(datetime, SWITCHOFFSET(GETUTCDATE(), DATEPART(TZOFFSET,
GETUTCDATE() AT TIME ZONE 'Arabian Standard Time'))) AS CreationTime
Replace GETUTCDATE()
with your table column that has the UTC time.
SELECT CONVERT(datetime, SWITCHOFFSET(GETUTCDATE(), DATEPART(TZOFFSET,
GETUTCDATE() AT TIME ZONE 'Arabian Standard Time'))) AS CreationTime
Replace GETUTCDATE()
with your table column that has the UTC time.
This page is open source. Noticed a typo? Or something unclear?
Improve this page on GitHub
Written byAbhith Rajan Follow @AbhithRajan
Abhith Rajan is a software engineer by day and a full-stack developer by night. He's coding for almost a decade now. He codes 🧑💻, write ✍️, learn 📖 and advocate 👍.
Connect
Time Zones and the DATETIMEOFFSET data type in SQL
High Availability and SLA for Azure SQL Managed Instance
Using SQL Data Sync for Bidirectional Data Replication in SQL Server & Azure SQL DBs | Data Exposed