-3

I have the following table with epch unix datetime stamps. Can someone let me know if there is SQL query or function that will allow me to convert / replace the the UNIX EPOCH time to SQL format

enter image description here

GMB
  • 216,147
  • 25
  • 84
  • 135
Carltonp
  • 1,166
  • 5
  • 19
  • 39
  • 3
    Far too much rep to make no attempt - a trivial search would find suggestions – SMor Mar 15 '20 at 22:58
  • 1
    And, of course, the duplicate posting on [msdn](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/287c0194-4b96-432d-8a48-4fd8b379e249/how-to-query-unix-time-stamp-in-sql?forum=transactsql) to waste efforts. – SMor Mar 15 '20 at 23:03

1 Answers1

0

An epoch timestamp represents the number of seconds elapsed since January 1st, 1970. In SQL Server, you can use dateadd() to perform this computation:

dateadd(second, start_timeslot_unix, '19700101') start_timeslot_datetime

If your epochs are expressed in milliseconds instead of seconds, then: dateadd(second, start_timeslot_unix / 1000, '19700101').

GMB
  • 216,147
  • 25
  • 84
  • 135