开发者

Convert date to elapsed time

Right now I have a date value like so:

2011-04-29T07:08:22.000Z

I want开发者_运维技巧 to turn this in to a live updating (no page refresh) elapsed time representation.

What is the most efficient way to do this?


Use jquery timeago, it's really good and easy.

You just do something like this for initialization :

jQuery(document).ready(function() {
  jQuery("abbr.timeago").timeago();
});

And like this everywhere you want some time to be displayed :

<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜