converting Epoch timestamp to sql server(human readable format)

Use the DATEADD function:

SELECT DATEADD(ss, 1291388960, '19700101')

…specifying a date of January 1st, 1970. In this example, it was provided in the YYYYMMDD format.

DATEADD will return a DATETIME data type, so if you have a table & column established — you can use the function to INSERT/UPDATE depending on your needs. Provide details, and I’ll clarify. Once you have a DATETIME to work with, you can use CAST or CONVERT to format the date in TSQL.

Leave a Comment