Sql server utc to local

This article is tagged with: Sql server utc to local and mysql

sql server utc to local

SELECT
['TIME COLUM TO CONVERT'] AS [UTC_TIME],
DATEADD(hh, DATEDIFF(hh, GETUTCDATE(), GETDATE()),['TIME COLUM TO CONVERT']) AS [lOCAL_TIME]
FROM ['TABLE NAME']

convert utc to est sql

select CONVERT(datetime, SWITCHOFFSET(dateTimeField, DATEPART(TZOFFSET,
dateTimeField AT TIME ZONE 'Eastern Standard Time')))

tsql utf to local time

select
[MyUtcDate] + getdate() - getutcdate()
from [dbo].[mytable]

This article is tagged with: Sql server utc to local and mysql