Home > Blockchain >  How to convert unix epoch format date to UTC in SQL query?
How to convert unix epoch format date to UTC in SQL query?

Time:11-09

I am having this format of datetime 1610382439.I am looking sql query to convert it to UTC time.

CodePudding user response:

One solution is to add those seconds to 1970-01-01. The datetime datatype does not adjust for DST:

select cast('1970-01-01' as datetime)   interval 1610382439 second
-- 2021-01-11 16:27:19

CodePudding user response:

In SQL server and .net world it called ticks. You can take a look at this link which shows how to convert it: Convert .NET Ticks to SQL Server DateTime

  • Related