I’m on the current weather project and am trying to incorporate the sunrise and sunset times. The jQuery request gives you this format for the time, 1479212760. After looking around I found out how to convert that into “Tue Nov 15 2016 19:01:00 GMT-0500 (Eastern Standard Time),” which isn’t the correct time for the sunrise. Also, it is impossible to find a straight forward way to get just the hours and minutes from that format with JavaScript. Here is the code I’m trying to use, any help would be greatly appreciated, Thanks.
/*Retreiving the OpenWeatherMap date from the jQuery request and converting it into standard long format.*/
var sunriseDate = Date(value.sys.sunrise);
/*Getting the hours from the date value*/
var sunriseHour = sunriseDate.getHour();
/*Getting the minutes from the date value*/
var sunriseMinutes = sunriseDate.getMinutes();
/*Creating the full correct formatted time for sunrise in order to be used later*/
var sunrise = String(sunriseHour) + ":" + String(sunriseMinutes) + " AM";