jeudi 2 novembre 2017

Ajax Weather API

I am currently attempting to create my version of a weather api and I have hit a slight snag. I am attempting to show when the sunrise is due in hours and minutes, but I have no idea how to convert it from milliseconds to a human readable format.

This is the number that I get at this point in time "1509606238" I am receiving this number from this bit of JSON.

 "sys": {
 "message": 0.0025,
 "country": "JP",
 "sunrise":1509606238,
 "sunset": 1509640499
  }

In my code, the JSON has been JSON.parse().




Aucun commentaire:

Enregistrer un commentaire