0

My problem is that I am receiving a timestamp from another app. When I convert the timestamp to time the time that gets returned is always wrong

This is the JavaScript code:

var time = new Date(timeStamp);

timeStamp = 1520934000461. My app returns the time: Tue Mar 13 2018 10:40:00 and the actual time is one hour earlier.

I tested the timeStamp with online converters and the converting is right and the timeStamp that comes to my app is right.

thank you

Endrit Sheholli
  • 101
  • 1
  • 3
  • 19

1 Answers1

1

I think it can be a problem about your client or server time config. Check your client's and server's timezone.

Otherwise, you can use this hacky solution (from here)

d = new Date(value) ; d.setTime( d.getTime() - new Date().getTimezoneOffset()*60*1000 );