If javascript “(new Date()).getTime()” is run from 2 different Timezones

后端 未结 5 2011
忘掉有多难
忘掉有多难 2020-12-09 01:02

If JavaScript (new Date()).getTime() is run from 2 different timezones simultaneously, will you get the same value?

Will this value be affected by the s

5条回答
  •  囚心锁ツ
    2020-12-09 01:39

    Code:

    var today = new Date();
    console.log(today);
    var t = today.getTime();
    console.log(t);
    

    My Computer in the UK:

    Sat Sep 21 2013 03:45:20 GMT+0100 (GMT Daylight Time)
    1379731520112 
    

    My VPS:

    Sat, 21 Sep 2013 02:44:31 GMT
    1379731471743
    

    Difference between getTime values is 48,369 milliseconds (48s) out of sync not the 1 hour zone difference

提交回复
热议问题