GitHub – Main Server Time Zone Information

githubtime zone

Which time zone is GitHub working from on their servers?

For example, a commit made on Sun Dec 2 05:01:00 2012 +0200 is interpreted by GitHub as a commit made on 1st December 2012 in the contributions calendar/graph.

Which is the first hour when a new day starts?

Best Answer

GitHub uses a strategy that involves the date-time-offset pattern. When you make a commit, the timestamp includes your offset from UTC.

You can see this in the API docs for the Commits. The sample they show there uses a commit timestamp of "2010-04-10T14:10:01-07:00". This is a valid ISO8601 representation of a date-time-offset. For the person performing the commit, it was April 10th 2010 at 14:10:01. The item would show up on his commit calendar for Saturday, April 10th.

Git and GitHub do not attempt to normalize this data to the offset of the viewer, but they do take it into account when calculating relative time strings. For example, there's a commit on a project I work on that says it was made "1 hour ago". It's 1:30 my time, but when I hover over that text it looks like it was made at 2:30. How can that be? Because my offset is currently -07:00 and the person who made the commit has an offset of -05:00.

So there is no system-wide first hour of the start of a day. Two commits made at the exact same moment in time might appear on two different days even on the same calendar, if they were made by people in different time zones. In other words, a "GitHub day" is a virtual "floating" calendar date that aligns to the committer - not necessarily the viewer.