Timezones and the REST API - GitHub Docs
Skip to main content

Timezones and the REST API

Some REST API endpoints allow you to specify timezone information with your request.

Some requests that create new data, such as creating a new commit, allow you to provide timezone information when specifying or generating timestamps.

Note that these rules apply only to data passed to the API, not to data returned by the API. Timestamps returned by the API are in UTC time, ISO 8601 format.

Determining the timezone for a request

To determine timezone information for applicable API calls, we apply these rules in order of priority:

  1. Explicitly providing an ISO 8601 timestamp with timezone information
  2. Using the Time-Zone header
  3. Using the last known timezone for the user
  4. Defaulting to UTC without other timezone information

Explicitly providing an ISO 8601 timestamp with timezone information

For API calls that allow for a timestamp to be specified, we use that exact timestamp. These timestamps look something like 2014-02-27T15:05:06+01:00.

An example of this is the API to manage commits. For more information, see REST API endpoints for Git commits.

Using the Time-Zone header

It is possible to supply a Time-Zone header, which defines a timezone according to the list of names from the Olson database.

curl -H "Time-Zone: Europe/Amsterdam" -X POST https://api.github.com/repos/github-linguist/linguist/contents/new_file.md

This means that we generate a timestamp for the moment your API call is made, in the timezone this header defines.

For example, the API to manage contents generates a git commit for each addition or change, and it uses the current time as the timestamp. For more information, see REST API endpoints for repository contents. The Time-Zone header will determine the timezone used for generating that current timestamp.

Using the last known timezone for the user

If no Time-Zone header is specified and you make an authenticated call to the API, we use the last known timezone for the authenticated user. The last known timezone is updated whenever you browse the GitHub website.

Defaulting to UTC without other timezone information

If the steps above don't result in any information, we use UTC as the timezone.

TMZ Celebrity News – Breaking Stories, Videos & Gossip

Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

🎥 Watch TMZ Live

TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.