最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - What format is this date value in? - Stack Overflow

programmeradmin5浏览0评论

Here's a forecast for London, GB from the Open Weather Map in JSON format.

.5/forecast/daily?id=524901

Each list item in the JSON has a key within it called dt that looks like "dt":1399626000

I haven't done this before, so how do I figure out what format (unix timestamp?) and timezone dt is in (e.g. GMT, UTC), and how to translate the dt into a human-friendly format.

Here's a forecast for London, GB from the Open Weather Map in JSON format.

http://api.openweathermap/data/2.5/forecast/daily?id=524901

Each list item in the JSON has a key within it called dt that looks like "dt":1399626000

I haven't done this before, so how do I figure out what format (unix timestamp?) and timezone dt is in (e.g. GMT, UTC), and how to translate the dt into a human-friendly format.

Share Improve this question edited May 10, 2014 at 3:35 Jason Aller 3,65228 gold badges41 silver badges39 bronze badges asked May 10, 2014 at 3:32 BenjaminBenjamin 7212 gold badges10 silver badges23 bronze badges 2
  • "How to translate the dt into a human-friendly format" momentjs. – Felix Kling Commented May 10, 2014 at 3:38
  • possible duplicate of Convert a Unix timestamp to time in Javascript – Ayman Safadi Commented May 10, 2014 at 3:38
Add a ment  | 

1 Answer 1

Reset to default 14

If I'm on the right page, the API documentation says here that it's a GMT Unix timestamp:

dt | Time of data receiving in unixtime GMT

To convert it into a human-readable format using JavaScript, see the answer to this question.

发布评论

评论列表(0)

  1. 暂无评论