jquery tmpl格式化日期?
我正在使用jquery tmpl在表中显示一堆结果。 其中一个是我在模板中输出的日期:
${EffectiveDate}
但它的格式为“/ Date(1245398693390)/”。 如何更改它以使其格式化为m / dd / yyyy h:mm tt?
只需使用函数格式化日期:
模板:
${GetDate(EffectiveDate)}
function:
function GetDate(jsonDate) { var value = new Date(parseInt(jsonDate.substr(6))); return value.getMonth() + 1 + "/" + value.getDate() + "/" + value.getFullYear(); }
{{= format(new Date(parseInt(EffectiveDate.substr(6))), 'd') }}
我建议使用这样的东西:
…
${EffectiveDate.CustomFormat()}