D
D
Denis2019-07-18 09:43:23
React
Denis, 2019-07-18 09:43:23

Strange data from the weather api, how to get the right values?

Good afternoon everyone.
I watched the practice of React.js on YouTube, there is an application that shows the weather for the selected city.
This is where I pull the data from api.openweathermap.org/data/2.5/weather?q=London,u...
The temperature is in a strange value, I would like to get the usual degrees, but somehow I didn’t really figure out how to do it
. sunset, yes, the values ​​themselves that were pulled from json were thrown over new date, but for all cities it showed the same 3 hours and something like minutes.
I thought maybe something in the code, reviewed the lessons one more time and repeated after the author, but the situation is the same.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hzzzzl, 2019-07-18
@fristyr

link &units=metric
api.openweathermap.org/data/2.5/weather?q=London,u...
"sunrise":1563422638,"sunset":1563480543
for new Date times 1000,
sunset

new Date(1563480543000)
Thu Jul 18 2019 23:09:03 GMT+0300 (Eastern European Summer Time)

why so:
https://stackoverflow.com/questions/847185/convert...

S
Stalker_RED, 2019-07-18
@Stalker_RED

She is in Kelvin .

"temp_min": 288.15,
"temp_max": 291.15
288.15 - 273.15 = 15
291.15 - 273.15 = 18

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question