2011-11-11 41 views
2

能否請你告訴我如何在jQuery的模板與時間格式日期是這樣的:格式化日期和時間jQuery的模板

11/9/2011 12:00:00 AM

我使用這個功能只格式化日期部分,隱藏了它的時間部分:

function (jsonDate) { 
    var value = new Date(parseInt(jsonDate.substr(6))); 
    return value.getMonth() + 1 + "/" + value.getDate() + "/" + value.getFullYear(); 
} 

回答

1

如何:

function (jsonDate) { 
    var value = new Date(parseInt(jsonDate.substr(6))); 
    return value.toUTCString(); 
} 

您可以看到更多選項here