81

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
  • 34,448
  • 50
  • 182
  • 322
  • 1
    From the page: "Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons." - I wonder if that covers `Etc/UTC` as well? –  Jan 02 '13 at 20:28
  • Probably: Following [chrisbulmer's answer](http://stackoverflow.com/a/14128617/759866), I would suspect it to be non-standard! – BenMorel Jan 02 '13 at 22:56

3 Answers3

78

Short answer

NO, there is no difference between time zones UTC and Etc/UTC.

Long answer with context

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.

While most timezones (e.g. "Berlin") can be attributed to an area (e.g. "Europe", resulting in "Europe/Berlin"), some timezones cannot be attributed to any Area of the world (think continents or oceans). Thus, the special Area Etc (Etcetera) was introduced. Area Etc applies mainly to administrative timezones such as UTC.

In summary: To conform with the naming convention, the universal coordinated time(zone) is named Etc/UTC in the tz database.

Note on tz database and POSIX timezones

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).

This POSIX convention is the opposite of the definition for timezones in the nowadays widespread and mostly used ISO 8601. In the ISO 8601 timezone format, negative signs indicate that a zone is behind UTC (west of Greenwich) and positive signs indicate a zone is ahead of UTC (east of Greenwich). Examples: "+03:00" in ISO 8601 equals GMT-3 in POSIX; "−05" in ISO 8601 equals "GMT5" in POSIX.

The ISO 8601 convention has become the effective standard nowadays, making POSIX timezones look confusing to some readers.

Possible reasons for POSIX timezone definition
  • 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 (i.e. "Eastern Standard Time, 5 hours behind Greenwich), PST8 (i.e. "Pacific Standard Time, 5 hours behind Greenwich), i.e. omitting the (+) sign.
  • Nowadays, most 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" means it is "11:30 UTC".
Andreas Rayo Kniep
  • 5,674
  • 2
  • 30
  • 30
  • 1
    @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. – Andreas Rayo Kniep Mar 23 '16 at 00:19
  • In case you need a source, the [Wikipedia page](https://en.wikipedia.org/wiki/Tz_database#Area) covers this information. – M. Justin Jan 05 '18 at 19:51
  • 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. – CodingInTheUK Sep 17 '19 at 23:27
51

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.

Chris Maggiulli
  • 3,375
  • 26
  • 39
David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • 3
    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! – BenMorel Mar 20 '13 at 11:37
  • @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. – David Schwartz Mar 20 '13 at 11:40
  • 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! – BenMorel Mar 20 '13 at 11:44
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..

arganzheng
  • 1,294
  • 15
  • 20