Understanding the etc/Gmt Time Zone

Understanding the Etc/GMT time zone

Etc/GMT is not strictly the same thing as UTC or GMT. They represent the same instant in time only when the offset is 0. In all other cases, they are quite different.

Apple explains the designation here.

A quote directly from the link gives an example:

We use POSIX-style signs in the Zone names and the output abbreviations,
even though this is the opposite of what many people expect.
POSIX has positive signs west of Greenwich, but many people expect
positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses
the abbreviation "GMT+4" and corresponds to 4 hours behind UTC
(i.e. west of Greenwich) even though many people would expect it to
mean 4 hours ahead of UTC (i.e. east of Greenwich).

Time zones `Etc/GMT`, why it is other way round?

This is not a bug. The tz database identifiers of the form Etc/GMT±* deliberately have an inverted sign than the usual forms we expect under ISO 8601. That is, they are in terms of positive values being West of GMT, rather than positive values being East of GMT.

The reason is for backwards compatibility with POSIX style time zone identifiers, such as are used with the first format of the TZ environment variable. When POSIX compliant systems interpret this variable, values like America/Los_Angeles would clearly fall through to the third format (described in the same document), but values like Etc/GMT+11 are ambiguous as to which format rules should apply. Thus the zone identifiers must have their signs inverted to be compliant.

From the tz database where these zones are defined:

# Be consistent with POSIX TZ settings in the Zone names,
# even though this is the opposite of what many people expect.
# POSIX has positive signs west of Greenwich, but many people expect
# positive signs east of Greenwich. For example, TZ='Etc/GMT+4' uses
# the abbreviation "-04" and corresponds to 4 hours behind UT
# (i.e. west of Greenwich) even though many people would expect it to
# mean 4 hours ahead of UT (i.e. east of Greenwich).

This is also discussed in the Wikipedia article on the tz database.

As far as practical matters, the tz database commentary also says:

# These entries are mostly present for historical reasons, so that
# people in areas not otherwise covered by the tz files could "zic -l"
# to a time zone that was right for their area. These days, the
# tz files cover almost all the inhabited world, and the only practical
# need now for the entries that are not on UTC are for ships at sea
# that cannot use POSIX TZ settings.

So, if you're not keeping time for ships at sea, I highly suggest you use a locality based identifier instead. (perhaps Australia/Melbourne ?)

Also, A better source of time zone identifiers would be the one on Wikipedia.

Since you said you were using PHP note that the PHP documentation has a list as well, and on the "Others" page, it actually explains this as well:

Warning
Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons, and may expose erroneous behavior.

Warning
If you disregard the above warning, please also note that the IANA timezone database that provides PHP's timezone support uses POSIX style signs, which results in the Etc/GMT+n and Etc/GMT-n time zones being reversed from common usage.

For example, the time zone 8 hours ahead of GMT that is used in China and Western Australia (among other places) is actually Etc/GMT-8 in this database, not Etc/GMT+8 as you would normally expect.

Once again, it is strongly recommended that you use the correct time zone for your location, such as Asia/Shanghai or Australia/Perth for the above examples.

What does Etc mean in time zone definitions

The zone identifiers starting with "Etc/..." come from TZDB-repository maintained by Paul Eggert and hosted by IANA. There is following private non-official github-based repository (labelled as experimental but can be considered as preparing repository for TZDB): github.com/eggert/tz

There you will find an etcetera-file. The zone identifiers mentioned above are available in this file. So the answer is:

"Etc" stands for "et cetera" (latin for "and so forth").

About the motivation of such naming, I think it is best to directly ask the maintainer of TZDB-repository Paul Eggert on the IANA-mailing-list.

How does GMT IDs work in Java TimeZone?

The Etc/GMT... time zones are there primarily for backwards compatibility with POSIX standards, which specified positive offsets west of GMT instead of the typical convention east of GMT that you might be used to.

In most cases, you should not use them. For example, if you are in the US Pacific time zone, you should use the identifier America/Los_Angeles. It alternates between UTC-8 for standard time in the winter, and UTC-7 for daylight time in the summer. You shouldn't just use Etc/GMT+8, because that wouldn't account for daylight saving time.

Other than backwards compatibility, another area where these fixed-offset zones come into play is for nautical purposes. Ships at sea have a lot of control over how they set their time, but they typically use fixed offsets separated by 15 degrees of longitude. It would be perfectly acceptable for a ship in the Atlantic ocean to use a time zone setting identifier of Etc/GMT+3.

Just don't forget to invert the sign. Etc/GMT+3 = UTC-3

Additional reading:

  • The comments in the etcetera file of the IANA/Olson time zone data
  • The timezone tag wiki
  • Wikipedia article on Nautical Time

What is the difference between UTC and GMT?

There is no time difference between Coordinated Universal Time and Greenwich Mean Time.

7:17 AM Friday, Coordinated Universal Time (UTC) is

7:17 AM Friday, Greenwich Mean Time (GMT)

Key difference: Both UTC and GMT are time standards that differ in terms of their derivation and their use.

To quote timeanddate.com:

The Difference Between GMT and UTC:

Greenwich Mean Time (GMT) is often interchanged or confused with
Coordinated Universal Time (UTC). But GMT is a time zone and UTC is a
time standard.

Although GMT and UTC share the same current time in practice, there is
a basic difference between the two:

  • GMT is a time zone officially used in some European and African countries. The time can be displayed using both the 24-hour format (0 - 24) or the 12-hour format (1 - 12 am/pm).
  • UTC is not a time zone, but a time standard that is the basis for civil time and time zones worldwide. This means that no country or
    territory officially uses UTC as a local time.

Is there a difference between the UTC and Etc/UTC time zones?

Etc/UTC is the time zone whose display name is UTC. That is, they're long and short names for the same timezone, per IANA's time zone database.



Related Topics



Leave a reply



Submit