Weather API Object

Weather API Object
0.0 0

#1

Tell us what’s happening:

I want to know how to interpret certain data in the object you get as a result of the fcc weather api. I’ve pasted the relevant bits below. So for example, the pressure is 1029, but what units is that in? What does “dt” even mean? The sunrise is 1519040590 but how does that translate into the actual time (AM/PM)? I don’t know how to interpret any of these.

Thanks.

Your code so far

"base":"stations"
"pressure":1029
"visibility":16093
"wind":{"deg":180}
"clouds":{"all":90}
"dt":1519071300
"sys":{"sunrise":1519040590,"sunset":1519079772}
"cod":200

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (X11; CrOS x86_64 10176.68.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.144 Safari/537.36.

Link to the challenge:


#2

Hello,

The pressure is most likely in hPa (hectopascals): https://en.wikipedia.org/wiki/Pascal_(unit)

dt, sunrise and sunset look like they are provided in Unix time: https://en.wikipedia.org/wiki/Unix_time

I’m not sure what dt stands for. The value in your code (if I’m right about the Unix time) translates to Monday, 19 February 2018 20:15:00 (GMT). Here is a handy converter: https://www.epochconverter.com/

Sidenote: the javascript Date constructor (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/prototype) mostly relies on unix time to calculate dates. To get a human friendly date format you need to create an instance of the Date object like so:

var myDate = new Date([your weather object name].sys.sunrise)
var dateString = myDate.toUTCString()

Hope this helps!