1

I'm trying to obtain the duration of something. I have the start and end time in ms so I do the diff between the two values. But when I try to show it in HH:mm:ss format the timezone is different.

Start time : 1658150216000 | 18.07.2022 15:16:56
End time : 1658160216000 | 18.07.2022 18:03:36
Diff : 10000000 | (should be) 02:46:40 | (shows) 03:46:40

The first two dates are created with GMT+0200 but the diff time is created with GMT+0100, and I don' get to modify this timezone.

I also tried to parse just the number but gets the same result {{ 10000000 | date:'HH:mm:ss' }}

Different time zones

Heap
  • 79
  • 1
  • 6
  • Could you post your code how you did the calculation? From your sreenshot it seems like you interpret the diffecrence as a new Date and there is not only the timezone different, it also says 1970 instead of 2022. – LeBavarois Aug 11 '22 at 07:29
  • You could also try if those answers to similar questions solve your problem, here: https://stackoverflow.com/questions/542938/how-to-calculate-number-of-days-between-two-dates and here: https://stackoverflow.com/questions/3224834/get-difference-between-2-dates-in-javascript – LeBavarois Aug 11 '22 at 07:32

0 Answers0