如何用jQuery模板I格式日期/时间? [英] How do I format Date/Time with jQuery Templates?

查看:267
本文介绍了如何用jQuery模板I格式日期/时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用 jQuery的模板作为我的JavaScript模板引擎才刚刚开始。我的问题是,我怎么能格式化表格的日期(从ASP.NET的Json的ActionResult返回):

i've just started using jQuery Templates as my javascript template engine. My question is, how can i format a date (returned from a ASP.NET Json ActionResult) in the form:

/Date(1288709830000)/

我试着做以下几点:

I tried doing the following:

{{= $.format(new Date(parseInt(comment.DateCreated.substr(6))), 'd')}} 

请注意上面使用了新的jQuery插件全球化添加 $。格式方法。还要注意的是 {{= comment.DateCreated}} 长手说 $ {comment.DateCreated}

Note the above uses the new jquery globalization plugin to add the $.format method. Also note that {{= comment.DateCreated }} is long hand for saying ${comment.DateCreated}.

我真的AP preciate如果你能有所帮助。

I'd really appreciate it if you could help.

推荐答案

这不实际工作。我用的是托管在微软CDN的beta版。如果您下载最新版本的一切正常。

This does actually work. I was using the beta version hosted on the Microsoft CDN. If you download the latest version everything works as expected.

这篇关于如何用jQuery模板I格式日期/时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆