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

1 Answer 1

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 );

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.