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 : Hresult: 0x80004005 Description: "Invalid character value for cast specification".

SSAS Error : XML parsing failed at line 1, column 0: A document must contain exactly one root element