我有以下JavaScript代码,但是出于某种原因,时间不包括分钟:
var austDay = $("#<%= hiddenFieldTime.ClientID %>").val().split(" ");
var year = austDay[0];
var months = austDay[1];
var days = austDay[2];
var time = austDay[3];
var timeUntil = new Date(parseInt(year), parseInt(months),
parseInt(days), parseInt(time));
当我使用Firebug调试时,以下是我的值:$("#ctl00_hiddenFieldTime").val() = "2011, 5, 6, 14:20:00"
year = "2011,"
months = "5,"
days = "6,"
time = "14:20:00"
timeUntil = Date {Mon Jun 06 2011 14:00:00 GMT-0400 (Eastern Daylight Time)}
正如你所看到的,timeUntil
被设置为 14:00:00
而不是 14:20:00