getTime() returns unixtme different from date

Asked

Viewed 46 times

0

I have a date string that when I assign this string to a date and later I’ll take the getTime of it, if the application is running on different machines the returned unixtime comes with a few different hours being two hours the difference.

Why and how to set this so that the unixtime comes with the date of the string I passed.

Code:

var data = "2018-02-12T10:20:00"
var dataString = new Date(data);
dataString.getTime();
  • The two machines are in different time zones ? If yes build the date also indicating the time zone

  • I want to leave just this bit of dynamite. But one question is whether I mounted the string with the date I wanted because it would pick machine spindle on getTime?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.