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

71,433

Solution 1

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.

Solution 2

Firstly, to answer the question:
There is NO difference between UTC and Etc/UTC time zones.

Etc/UTC is a timezone in the Olson-timezone-database (tz database), also known as IANA-timezones-database, in which all timezones conform to a uniform naming convention: Area/Location.

Since, some timezones cannot be attributed to any Area of the world (i.e. continents or oceans), the special Area Etc (Etcetera) was introduced. This applies mainly to administrative timezones such as UTC.
Thus, to conform with the naming convention, the universal coordinated time(zone) is named Etc/UTC in the tz database.

For administrative timezones other than UTC (e.g. GMT+4, GMT-8), the tz database uses POSIX-style signs in the zone-names. POSIX has positive signs for zones that are behind Greenwich (west of Greenwich) and negative signs for zones that are ahead of Greenwich (east of Greenwich).

POSIX-style signs in timezones are the opposite of the definition of timezones in the nowadays widespread and mostly used ISO 8601. In the ISO 8601 timezone format, negative signs indicate a zone is behind UTC (west of Greenwich) and positive signs indicate a zone is ahead of UTC (east of Greenwich). This is what has become the standard usage nowadays.

Possible reasons for the opposite definition in POSIX are:

  • POSIX is part of UNIX, which was developed in the USA, which is behind UTC (west of Greenwich). The POSIX format allows the US timezones to be represented as EST5, PST8, i.e. omitting the (+) sign.
  • Usually, computer programs and operating systems internally do everything in UTC time. With POSIX-style signs you can add time and timezone in order to get UTC time. Example: "03:30 PST8" or "03:30 GMT+8" mean it is "11:30 UTC".

Solution 3

ETC/GMT+4 is the same as GMT-4.

public static void main(String[] args) {
    TimeZone tz = TimeZone.getTimeZone("Etc/GMT-7");
    System.out.println(tz);

    tz = TimeZone.getTimeZone("GMT+7");
    System.out.println(tz);

}

You can test it by yourself.

But I don't know what ETC mean..

Share:
71,433
BenMorel
Author by

BenMorel

Author of Brick, a collection of open-source libraries for PHP applications: brick/math : an arbitrary-precision arithmetic library brick/money : a money and currency library brick/date-time : a date and time library brick/phonenumber : a phone number library brick/geo : a GIS geometry library brick/varexporter : a powerful alternative to var_export() ... and a few others.

Updated on July 08, 2022

Comments

  • BenMorel
    BenMorel almost 2 years

    In the PHP documentation, list of supported time zones, UTC is listed twice:

    • UTC
    • Etc/UTC

    Is there any conceptual difference between those two, or are they just synonyms?

  • BenMorel
    BenMorel about 11 years
    That's not how I understand this document: "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)." So it goes the reverse way, and unless UTC does this as well, they're really opposites!
  • David Schwartz
    David Schwartz about 11 years
    @Benjamin: We're talking about the UTC time zone which has an offset of zero. Positive zero and negative zero are the same number and there's no offset anyway.
  • BenMorel
    BenMorel about 11 years
    I do understand that, but my question applies equally to Etc/GMT+1 etc. I'm surprised that only Etc versions are proposed, where I thought that the general consensus was to use GMT+1, and not the "reverse" versions!
  • Andreas Rayo Kniep
    Andreas Rayo Kniep about 8 years
    @chinoto: For some reason, I just came across this threat again and realized that the other answer (see below) ends by saying "But I don't know what ETC mean.." - I assume that is what you were referring to.
  • M. Justin
    M. Justin over 6 years
    In case you need a source, the Wikipedia page covers this information.
  • CodingInTheUK
    CodingInTheUK over 4 years
    I know this is old, but i think a better source would have been to the etc definition and the comment should have been on the appropriate answer.
  • BALAJI POTHULA
    BALAJI POTHULA over 3 years
    Etc (ETC) mean etcetera link