new Date() works differently in Chrome and Firefox

前端 未结 5 1638
走了就别回头了
走了就别回头了 2020-11-22 15:31

I want to convert date string to Date by javascript, use this code:

var date = new Date(\'2013-02-27T17:00:00\');
alert(date);

5条回答
  •  一整个雨季
    2020-11-22 16:17

    The correct format for UTC would be 2013-02-27T17:00:00Z (Z is for Zulu Time). Append Z if not present to get correct UTC datetime string.

提交回复
热议问题