Why UTC (which is not a time zone) is considered as a time zone in Java (and not only there)?

Given that UTC is not a time zone, but a time standard (as stated, for example, here), why in my Java application I can use UTC as if it was a time zone (see the code snippet below)?

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
format.setTimeZone(TimeZone.getTimeZone("UTC"));

If UTC is not a time zone, why is TimeZone.getTimeZone("UTC") able to return the time zone object?


By the way, on my Windows machine UTC is in the list of time zones also (see the screenshot).

Is the statement "UTC is not a time zone" in reality wrong?

UTC is a time zone in Windows

Jon Skeet
people
quotationmark

Because it makes life much, much simpler to regard UTC as a time zone than to treat it as something else, basically.

It's one of those "Yeah, strictly speaking it's not" scenarios. For everything except "Which region of the world is this observed?" you can think of UTC as a time zone and it works fine. So it's simpler to bend it slightly out of shape than to have a whole separate concept.

If you view a time zone as a mapping from "instant in time" to "UTC offset" (or equivalent, from "instant in time" to "locally observed time") then UTC is fine to think of as a time zone - and that's most of what we do within software.

If you view a time zone as a geographical region along with that mapping, then no, it doesn't work as well - but that's more rarely useful in software. (And you can always fake it by saying it's an empty region :)

people

See more on this question at Stackoverflow