0

显示小日期时出现问题。目前它显示长 UTC 日期和时间。

var events = [ 
    { Title: "Five K for charity", Date: new Date("03/13/2013"), Time: "11:15" }, 
    { Title: "Dinner", Date: new Date("03/25/2013"), Time: "11:15" }, 
    { Title: "Meeting with manager", Date: new Date("03/01/2013"), Time: "11:15" }
];


        for(var d=0;d<events.length;d++) {
        $('.myarray').append('<div><span>'+events[d].Title + '</span><br>' + events[d].Date + '<br>' + events[d].Time + '<br><br></div>');
        }
4

1 回答 1

0

你的event[]数组应该是这样的:

var events = [{
   Title: "Five K for charity",
   Date: "03/13/2013",
   Time: "11:15"
}, {
   Title: "Dinner",
   Date: "03/25/2013",
   Time: "11:15"
}, {
   Title: "Meeting with manager",
   Date: "03/01/2013",
   Time: "11:15"
}];

Date: new Date("03/25/2013"),这将创建具有标准的完整日期和时间。

于 2013-03-20T06:26:06.427 回答