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

SSAS : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. (Microsoft.AnalysisServices.AdomdClient). + Solution

SSIS Error : Unable to infer the XSD from the XML file. The XML contains multiple namespaces