Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
shakir kasmaniCourses Plus Student 3,418 Points
no timezone needed here?
In our Day Class we also used timezone,
what is use of timezone?
Rex Wang2,089 Points
Time zone is used to retrieve the correct time. The time we get from the forecast api has the following description:
The UNIX time (that is, seconds since midnight GMT on 1 Jan 1970) at which this data point occurs
Since this is GMT time, we want to convert the time received to the one that matches the region with longitude/latitude we supplied to the API call. If you did the extra challenge of the first part of this course, then the time you will see in the app should match the current time on your machine
If that is true, then why (using the exact same API response data) do we apply a time zone when getting the formatted of a
Dayobject, but not of an
Hourobject? It seems inconsistent to me.