var vdate= new Date(parseInt("1438405200000"));
var vmonth = vdate.getMonth() + 1;
alert(vmonth);
不正确当我创建日期变量从int值的JavaScript我得到不正确的月份, 在这个例子中的日期(1438405200000)是2015年8月1日
var vdate= new Date(parseInt("1438405200000"));
var vmonth = vdate.getMonth() + 1;
alert(vmonth);
警报显示7,正确的是8,这只发生在一些PC上。可以是区域设置或类似的东西吗?
月份为零索引。 –
使用'parseInt(“1438405200000”,10)' –
如果日期为01,Javascript日期返回错误的月份的可能重复(http://stackoverflow.com/questions/25288781/javascript-date-returns-wrong-month- if-day-is-01) –