Weather App: Showing Date with User's System

Weather App: Showing Date with User's System
0

#1

I’ve been making some decent progress on my weather app and have a question about how to display the date with my layout. I’m going for a Persona 4 weather HUD theme, so the day of the week is at the top of the screen, the number for the month in the middle, and the year below the month. I have no idea how to even start getting this to work. I was thinking the easiest way to do this would be with the user’s system date/time, but I’ve been coding in circles.

Here’s my code pen to show what I’m attempting to do: http://codepen.io/Qwicksilver/pen/kkZBrj


#2

Cool interface.

The API actually passes the date when the data was collected as ‘dt’

You can use it with something like the following:

  var d = new Date(0);
  d.setUTCSeconds(json.dt);
  console.log(d)

Once you have your date object ‘d’ you can use the normal methods for getting day, month, year, etc.


#3

Oh cool! Thank you! I wasn’t sure if the API did that or not. Glad to know I don’t have to re-invent the wheel. :slight_smile:
Glad you like the interface - here’s hoping I don’t break it while trying to get the date to work.