java - Why is subtracting these two times (in 1927) giving a strange result? - Stack Overflow

posted on 12/04/2013 14:17

http://stackoverflow.com/questions/6841333/why-is-subtracting-these-two-times-in-1927-giving-a-strange-result

This is an exciting puzzle. Just check out part of the answer:

It’s a time zone change on December 31st in Shanghai. See this page for details of 1927 in Shanghai. Basically at midnight at the end of 1927, the clocks went back 5 minutes and 52 seconds. So “1927-12-31 23:54:08” actually happened twice, and it looks like Java is parsing it as the later possible instant for that local date/time - hence the difference. Just another episode in the often weird and wonderful world of time zones.