在程序中,從數據庫中讀取到的日期時間類型數據一般是這種格式:"/Date(1355109408000+0800)/"
要經過js函數處理變為格式:'2012-12-10 11:05:21'
用此js函數即可搞定:
function timeFormatter(value) {
var da = new Date(parseInt(value.replace("/Date(", "").replace(")/" , "").split( "+")[0]));
return da.getFullYear() + "-" + (da.getMonth() + 1) + "-" + da.getDate() + " " + da.getHours() + ":" + da.getMinutes() + ":" + da.getSeconds();
}