Is there a lib to convert timestamp into time offset
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/
精彩评论