I want to convert pubDate(eg. "Sat, 14 Feb 2015 19:02:00 +0000") from rss to something like "x mins ago" like on twitter posts.
Is there a function which can convert pubDate format to something like "x mins ago"?
I want to convert pubDate(eg. "Sat, 14 Feb 2015 19:02:00 +0000") from rss to something like "x mins ago" like on twitter posts.
Is there a function which can convert pubDate format to something like "x mins ago"?
Might be an overkill in this case, but if the opportunity show moment.js is just awesome!
Moment.js is a javascript datetime library, to use it for this, you'd do:
moment(yourdate).fromNow()
Here is your answer :
link : https://coderwall.com/p/uub3pw/javascript-timeago-func-e-g-8-hours-ago
there is jQuery plugin also : timeago