admin管理员组文章数量:1410674
I m getting Time data in this format in an JSON Object.
"created_time": "2012-04-01T15:02:52+0000"
I need to convert this format to some readable time format like
3:02 PST 1 April, 2012
So the users understand it. I m using Jquery for handling this data. I tried doing it but I m not understanding which time format it is !
I m getting Time data in this format in an JSON Object.
"created_time": "2012-04-01T15:02:52+0000"
I need to convert this format to some readable time format like
3:02 PST 1 April, 2012
So the users understand it. I m using Jquery for handling this data. I tried doing it but I m not understanding which time format it is !
Share asked Apr 2, 2012 at 7:54 Narendra RajputNarendra Rajput 7119 silver badges29 bronze badges 2- 3 What have you tried? – PeeHaa Commented Apr 2, 2012 at 7:56
- I simply tried converting it simply by slicing the data and doing it manually ! But thats not a very efficient method. – Narendra Rajput Commented Apr 2, 2012 at 7:58
2 Answers
Reset to default 7You should be able to do something like this, which should actually be human readable:
var date = new Date("2012-04-01T15:02:52+0000")
console.log(date); //Sun Apr 01 2012 17:02:52 GMT+0200 (W. Europe Summer Time)
Using the Date object, you are able to convert it further, should you want.
See http://www.elated./articles/working-with-dates/ for some nice examples, like:
date.toDateString(); //Sun Apr 01 2012
I guess you want Timeago plugin !
本文标签: javascriptCovert Time Returned by Facebook Graph API to readable Time FormatStack Overflow
版权声明:本文标题:javascript - Covert Time Returned by Facebook Graph API to readable Time Format - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745054992a2639875.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论