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! While you're at it, check out some resources Treehouse students have shared here.
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
meagantan
Courses Plus Student 4,976 PointsTimezone on server/Portland related query
On the video "Manipulating Time Already" Kenneth mentions that the server time is different than his local time, which I presume is Pacific Standard Time as he would be in Portland, Oregon.
My question is what was the local time as of recording? Would it be as simple as subtracting eight hours to account for the UTC-8 offset? (This is based off of Kenneth saying that the time zone on the server was UTC (no offset).
Therefore when it is 18 (6pm), it's really 10am local time?
Therefore he would only have been at work for an hour, rather than the nine.
Can someone confirm if that is correct :)
2 Answers
Edward C. Young
10,323 PointsAt the time of writing this the time is:
- 4:50 AM UTC
- 11:50 PM CDT
Can you calculate my offset and give me the proper zoneinfo entry? I'll give the answers below, but first, quoting Wikipedia:
The tz database, also called tzdata, the zoneinfo database or IANA (Internet Assigned Numbers Authority) time zone database, is a collaborative compilation of information about the world's time zones, primarily intended for use with computer programs and operating systems. It is sometimes called the Olson database, referring to the founding contributor, Arthur David Olson. Paul Eggert is currently its editor and maintainer.
Its uniform naming convention for time zones, such as America/New_York and Europe/Paris, was designed by Paul Eggert. The database attempts to record historical time zones and all civil changes since 1970, the Unix time epoch. It also includes transitions such as daylight saving time, and also records leap seconds.
The database, as well as some reference source code, is in the public domain. New editions of the database and code are published as changes warrant, usually several times per year.
All linux based servers use the zoneinfo database to coordinate time across the Internet as a whole. Unless specified by the server's customer facing documentation, all timezone info is stored as UTC. UTC stands for Coordinated Universal Time, also known as the Universal Time Code, and is abbreviated in settings files as
- UTC
- GMT-0 (deprecated)
In order to calculate local time, each timezone in the world has an OFFSET VALUE, as you have correctly deduced:
You are correct in your calculation that you can subtract 8, which will give you the time in PDT (Pacific Daylight Time). The hard part in determining the time is this: Is the time zone that you're calculating determined to be East or West of the UTC/GMT line?
- Calculations to the east require that you add to a maximum of 12.
- Calculations to the west require that you subtract to a maximum of 12.
In America as a whole, most people start their work day at 8AM local time, meaning he would have been at work 2 hours. Most end their day at 5PM local time. Note that this creates a cascading effect, i.e, people in New York go to work 3 hours earlier than people in California, and therefore go home 3 hours earlier. I bring this up, because if someone working in California needs an item from someone in New York both sides must agree on how to handle the time-zone differences.
ANSWERS:
- CST | CDT: Central Time
- America/Chicago
meagantan
Courses Plus Student 4,976 PointsNice cheers! :)