为什么这不起作用,
数据中的字符串通常为movement at:2014-12-01T07:53:08
var temp1 = evt.data;
var temp2 = temp1.replace("movement at:", "");
document.getElementById('movementlabel').innerHTML = temp2;
alert(temp2);
var MovementtDate=New Date(temp2);
alert(MovementtDate);
答案 0 :(得分:0)
不应该是New
。它的new
!
var temp1 = "movement at:2014-12-01T07:53:08";
var temp2 = temp1.replace("movement at:", "");
document.getElementById('movementlabel').innerHTML = temp2;
alert(temp2);
var MovementtDate= new Date(temp2);
alert(MovementtDate.getMonth()); // check the month

<p id="movementlabel"></p>
&#13;