Strange Java Timezone Date Conversion Problem

This is the problem:

TimeZone.getTimeZone("Germany")

There’s no such time zone ID, so Java in its infinite wisdom decides to just return you UTC without telling you that anything’s wrong. Try this instead:

TimeZone.getTimeZone("Europe/Berlin")

Wikipedia has a list of IANA time zone IDs, but it’s somewhat out of date (at the time of writing); the IANA data is the most up-to-date, but it’s not as easily browsable…

Leave a Comment