我的项目中有一个奇怪的问题。我想动态插入参数到Date对象的构造函数。这里是我的代码:创建日期对象
from += fromYear + "," + fromMonth + "," + fromDay + "," + fromHour + "," + fromMinute;
to += toYear + "," + toMonth + "," + toDay + "," + toHour + "," + toMinute;
console.log(from); //here is log value: 2012,8,25,9,22
console.log(to); //another log: 2012,8,25,9,52
//Creating object
var fromtime = new Date(from);
var totime = new Date(to);
当我试图提醒日期对象(TOTIME或放在fromtime)有一个错误:无效的日期。我不知道如何通过它。你可以帮帮我吗?
我尝试这样做: Creating Date Object JS
没错。 +1指出0基地;) –