2

This is the data packet which was received from android mobile to my server.

  $|351746051743568|12.9399604|77.6257631|0.0|1392979784822|1|#

In which following is the time which is received from the device: 1392979784822. Since this is in GPS format, I tried to convert into local format in SQL and failed. Please guide me in this issue.

Rameshbabu
  • 57
  • 8
  • check this: http://stackoverflow.com/questions/2904256/how-can-i-convert-bigint-unix-timestamp-to-datetime-in-sql-server – BWS Feb 21 '14 at 14:02

1 Answers1

2

Looks like unix/epoch time in millisecs?

declare @x bigint = 1392979784822
declare @msin1day bigint = 3600 * 24 * 1000

select dateadd(ms, @x % @msin1day, dateadd(day, @x / @msin1day, '19700101'))

(No column name)
2014-02-21 10:49:44.823
Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Beware - if that really is GPS time then it isn't the same as unix time. There's a rather involved explanation here: https://aviation.stackexchange.com/questions/90839/what-are-satellite-time-gps-time-and-utc-time – Andrew Apr 27 '22 at 21:56