The problem is simple.
EST doesn’t mean what you think it means. That’s because nobody really knows what it means; it is ambiguous and context must provide what you mean.
There are 3 major meanings and layers to it:
It’s a three letter acronym, tons of places use this. Australia has an Eastern Standard Time. They call this
EST. The rest of the world, if the use an acronym at all, use AEST. At least this one is (probably) not the problem here, but note that if you parse that string using an australian locale, I wouldn’t be too surprised if it saw EST and decided that this means ‘Australia/Sydney’.
It is a fixed zone offset of UTC-5: “Eastern Standard Time”, as in, the timezone observed by New York (amongst other locations) in winter. In contrast to EDT, which is a fixed offset of UTC-4, called “Eastern Daylight savings Time”, and is what New York is on, but in summer. Note that New York went from EDT to EST on Nov 1st, so at the time you’ve provided, New York was not on EST as far as this definition is concerned.
It is the time in New York regardless of year: An zone and not an offset; it is UTC-5 during winter, and UTC-4 in summer, switching according to USA political rules.
I’d say definition #2 is the most sensible, but both others are common enough that you can’t just disregard them as wrong.
Parsing a timezone string involves a locale and that means you have no idea what it is going to do, when you provide something so very ambiguous.
Turns out that on your system’s default locale,
EST ends up parsing as that 3rd definition, so it gets turned into the ZoneId
America/New_York. I wonder if you meant UTC-5 (you probably didn’t; almost no location on the planet observes UTC-5 at the time you provided!), it sounds more plausible you actually meant the third definition.
ZoneId.of("EST", ZoneId.SHORT_IDS) uses the second definition.
Thus, you have two different concepts here, even though they are both using the acronym EST.
I concur with Arvind’s conclusion: Stop using TLAs for this stuff, they are just far too unclear. Use the full names, like
I have provided this answer to explain to you why you are seeing non-equal objects here.
CLICK HERE to find out more related problems solutions.