TSQL : Unix timestamp into Local time in sql server

DECLARE @epoch bigint
SET
@epoch = 1399518300002

select DATEADD(minute, DATEDIFF(minute, getutcdate(), getdate()), DATEADD(s, @epoch/1000, '19700101 00:00:00:000'))

Comments

Popular posts from this blog

SQL Server MDS : How to Know Actual MDS Table name for Model Entity and Column name for the Attribute

SSIS Error : Object is not an ADODB.RecordSet or an ADODB.Record + Solution

SSRS : [Teradata Database] 3939 There is a mismatch between the number of parameters specified and the number of parameters required.