0

How to convert long value difference of two time to seconds?

Example:

Insert Time is 2021-07-28 13:22:05.742906 -> Epoch Value 1627459467906
Update Time is 2021-07-28 13:22:17.779218 -> Epoch Value 1627459516218
Difference between Insert and Update Time is -> 1627459516218 - 1627459467906 = 48312

How to convert 48312 to seconds? [Either Manually or using code]

Martin
  • 16,093
  • 1
  • 29
  • 48
harry
  • 1
  • Your date to Epoch time values look incorrect to me... how did you calculate them? – Martin Jul 28 '21 at 12:18
  • So the difference I see in long time 48312 and in time is 12 seconds. But dividing 48312 by 1000 doesnt give 12 seconds. – harry Jul 29 '21 at 06:54

1 Answers1

0

The epoch value is the number of milliseconds since 1/1/1970, so the difference is in milliseconds: just divide it by 1000.

Pino
  • 7,468
  • 6
  • 50
  • 69
  • So the difference I see in long time 48312 and in time is 12 seconds. But dividing 48312 by 1000 doesnt give 12 seconds. – harry Jul 28 '21 at 12:55
  • As noted in another comment your epoch values are wrong, and also the difference is wrong, that's why you don't get 12 seconds as result. – Pino Jul 29 '21 at 15:12