解析日期类似于twitter的问题 [英] Problems parsing date like twitter
问题描述
当我收到用户的推文,twitter给我这个格式(链接json):
http://twitter.com /status/user_timeline/BarackObama.json?count=5&callback=308
/ pre>
created_at:Tue Jul 03 01:54:48 +0000 2012,
当我在此搜索一个主题标签时:
http ://search.twitter.com/search.json?callback =?& rpp = 5& q =%23wasabi
created_at:Thu,05 Jul 2012 14:31:57 +0000,
任何人都可以帮助我解析这些日期?
解决方案John Resig也有一个很好的小日期解析脚本。
http://ejohn.org/blog/javascript-pretty-date/
这是一个JSFiddle与你需要的代码。
更新与示例tweet抓住 - 你知道你想要我的答案;)
http:// jsfiddle。 net / ETACy / 4 /
I'm parsing tweets from twitter and I want to show dates like twitter "posted 40 minutes ago", "posted 1 hour ago" but I have the following problem:
When I get user tweets, twitter give me this format (link json):
http://twitter.com/status/user_timeline/BarackObama.json?count=5&callback=308 "created_at": "Tue Jul 03 01:54:48 +0000 2012",
When I search a hashtag this one:
http://search.twitter.com/search.json?callback=?&rpp=5&q=%23wasabi "created_at": "Thu, 05 Jul 2012 14:31:57 +0000",
Can anyone help me parse these dates?
解决方案John Resig has a nice little date parsing script too. http://ejohn.org/blog/javascript-pretty-date/
Here's a JSFiddle with the code you need.
Updated with example tweet grabbing - you know you want my answer ;)
这篇关于解析日期类似于twitter的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!