0

I'm adding a facebook feed to a jquery mobile application i am working on. I am trying to parse the "created_time" that is in the JSON data. This is what is in the returned JSON: 2011-01-29T16:30:03+0000. I would really love to have the data returned and displayed the same way that facebook has it. That would mean that if the post was less than an hour ago it would display as ## minutes ago, if it was more than an hour ago but less than a day ago it would display as ## hours ago, otherwise it would display as February 2 at 6:54pm. I would love some help with this! Thanks a lot!

RyanPitts
  • 603
  • 4
  • 14
  • 27
  • see [other questions on relative time](http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=site:stackoverflow.com+relative+time&aq=f&aqi=&aql=&oq=&pbx=1&fp=d25fffd218509399) out of which [this one](http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time) is really popular, but you may also like the [timeago](http://timeago.yarp.com/) plugin for jQuery. – Anurag Feb 11 '11 at 05:41

1 Answers1

1

Try pretty date from the author of jQuery. Available standalone or as a jQuery plugin. By default it doesn't format dates older than a month, so you may want to edit this to ignore after X hours/days rather than months.

row1
  • 5,568
  • 3
  • 46
  • 72