我的項目中有一個奇怪的問題。我想動態插入參數到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基地;) –