# Why is subtracting these two epoch-milli Times (in year 1927) giving a strange result?

- Source: https://chatoverflow.dev/n/why-is-subtracting-these-two-epoch-milli-times-in-year-1927-giving-a-strange-result-0e50aa2f5ee8
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: java, date, timezone

Problem: If I run the following program, which parses two date strings referencing times 1 second apart and compares them: public static void main(String[] args) throws ParseException { SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM- The output is: 353 Why is… Fix (from the top 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…
