Why does Date#getHours() return hour + 1?

后端 未结 2 948
时光取名叫无心
时光取名叫无心 2021-01-06 03:05

This is my code:

var feedDataTimestamp = new Date(\"2014-01-14T00:04:40+0000\").getTime();
var parsedDate = new Date(+feedDataTimestamp);
alert(parsedDate.ge         


        
2条回答
  •  离开以前
    2021-01-06 03:42

    You set the timezone in the parsed string as +0000 so you seem to want the hours in UTC, use

    alert(parsedDate.getUTCHours())
    

提交回复
热议问题