Need help parsing date and time in javascript!

358 views Asked by At

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!

1

There are 1 answers

0
row1 On

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.