0

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"?

  • Check out: http://stackoverflow.com/questions/3177836/how-to-format-time-since-xxx-e-g-4-minutes-ago-similar-to-stack-exchange-site – Michael Dziedzic Feb 15 '15 at 20:18

2 Answers2

1

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()

http://momentjs.com/docs/#/displaying/fromnow/

void
  • 36,090
  • 8
  • 62
  • 107
1

Here is your answer :

link : https://coderwall.com/p/uub3pw/javascript-timeago-func-e-g-8-hours-ago

there is jQuery plugin also : timeago

Mandeep Gill
  • 4,577
  • 1
  • 28
  • 34