开发者

Is there a lib to convert timestamp into time offset

开发者 https://www.devze.com 2023-01-25 07:19 出处:网络
I am looking for a javascript library that takes unix timestamp string as an input and converts it to something like \'5 minutes ago\', \'3 days ago\', etc...

I am looking for a javascript library that takes unix timestamp string as an input and converts it to something like '5 minutes ago', '3 days ago', etc...

The purpose is to display time difference of the forum post but I don't want to apply开发者_如何转开发 this logic in the php script on the server, I want to send the data just how it's stored in database and let the client do this extra work.

Does anybody know if class of function exists in any js library for this?


http://webdesign.onyou.ch/2010/08/04/javascript-time-ago-pretty-date/

and the mandatory jQuery plugin:

http://timeago.yarp.com/


Isnt is too trivial for "library"? Look at this: http://jsfiddle.net/xszSg/

0

精彩评论

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