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

SSIS :Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done

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

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