0

I need to convert Timestamp Data of (1679722784640) this to datetime format in sql server, I successfully converted the data referring this suggestion stackoverflow.com/a/3650475/14329025 but I need a clarification of what is the need of inputing ('1-1-1970 05:30:00') this date particularly, in case change the date or month or year ouput data show wrongly

--Unix timestamps input (1679722784640) to get Date and Time 2023-03-25 11:09:44

select dateadd(s, convert(bigint, 1679722784640) / 1000, convert(datetime, '1-1-1970 05:30:00'))

I need a clarification

Tushar
  • 3,527
  • 9
  • 27
  • 49

1 Answers1

0

1-1-1970 00:00:00 is as a reference date to convert the Unix timestamp to a readable date and time format.

As I copy it as it is from Epoch_Time

In computing, an epoch is a date and time from which a computer measures system time. Most computer systems determine time as a number representing the seconds removed from particular arbitrary date and time. For instance, Unix and POSIX measure time as the number of seconds that have passed since Thursday 1 January 1970 00:00:00 UT, a point in time known as the Unix epoch. This time is in UTC

As you are in India, You will be able to find extra 5 hours and 30 minutes (1-1-1970 05:30:00) as IST (India Standard Time) is 5 and half hours ahead of UTC (Coordinated Universal Time)

Tushar
  • 3,527
  • 9
  • 27
  • 49