Rus*_*sby 8 jquery templates json
我正在使用jquery tmpl在表中显示一堆结果.其中一个是我在模板中输出的日期:
<td class="textAlignRight">${EffectiveDate}</td>
Run Code Online (Sandbox Code Playgroud)
但它的格式为"/ Date(1245398693390)/".如何更改它,使其格式化为m/dd/yyyy h:mm tt?
Mar*_*man 19
只需使用函数格式化日期:
模板:
<td class="textAlignRight">${GetDate(EffectiveDate)}</td>
Run Code Online (Sandbox Code Playgroud)
功能:
function GetDate(jsonDate) {
var value = new Date(parseInt(jsonDate.substr(6)));
return value.getMonth() + 1 + "/" + value.getDate() + "/" + value.getFullYear();
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10055 次 |
最近记录: |