JDK-8262110 : DST starts from incorrect time in 2038
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 8,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-02-22
  • Updated: 2025-01-21
  • Resolved: 2021-03-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 15 JDK 16 JDK 17 JDK 7 JDK 8 Other
11.0.12-oracleFixed 13.0.8Fixed 15.0.4Fixed 16.0.2Fixed 17 b16Fixed 7u311Fixed 8u301Fixed openjdk8u302Fixed
Related Reports
Relates :  
Description
The customer reports that in 2038, DST should start from 2038/03/14 AM 2:00.  However, all JDK versions seem to have 2038/03/14 AM 4:00 as the starting time for the year 2038 and later.

Reproducer:

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class DSTTest {

       public static void main(String[] args) {
               try {
                       TimeZone timeZone =
TimeZone.getTimeZone("America/New_York");
                       SimpleDateFormat sdf = new
SimpleDateFormat("yyyy/MM/dd HH:mm:ss:SSS");
                       Long time = 0L;

                       sdf.setTimeZone(timeZone);
                       time = sdf.parse("2037/3/8 01:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));
                       time = sdf.parse("2037/3/8 02:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));
                       time = sdf.parse("2037/3/8 03:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));
                       time = sdf.parse("2037/3/8 04:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));

                       time = sdf.parse("2038/3/14 01:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));
                       time = sdf.parse("2038/3/14 02:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));
                       time = sdf.parse("2038/3/14 03:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));
                       time = sdf.parse("2038/3/14 04:30:00:000").getTime();
                       System.out.println(sdf.format(new Date(time)));

               } catch(ParseException e) {
                       System.err.println(e.getMessage());
               }
       }
}


Expected:
2037/03/08 01:30:00:000
2037/03/08 03:30:00:000
2037/03/08 03:30:00:000
2037/03/08 04:30:00:000
2038/03/14 01:30:00:000
2038/03/14 03:30:00:000
2038/03/14 03:30:00:000
2038/03/14 04:30:00:000

Actual:
2037/03/08 01:30:00:000
2037/03/08 03:30:00:000
2037/03/08 03:30:00:000
2037/03/08 04:30:00:000
2038/03/14 01:30:00:000
2038/03/14 02:30:00:000
2038/03/14 02:30:00:000
2038/03/14 04:30:00:000

Comments
Fix request (13u): old copyright year differs in 13u code! Other than that, no surprises.
15-04-2021

Fix request (15u): the patch applies seamlessly.
14-04-2021

Fix Request (11u) I would like to backport this patch to 11u for parity with Oracle 11.0.12. 11u changes have been reviewed here: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-April/005718.html
14-04-2021

Fix Request(16u): Please approve pushing the change to JDK 16u. This is a long-standing issue in the Calendar API where the DST transition logic beyond the year 2037 was incorrect. The fix is simple and the impact is low. Passed regression
08-04-2021

Changeset: 7284f013 Author: Naoto Sato <naoto@openjdk.org> Date: 2021-03-26 17:13:49 +0000 URL: https://git.openjdk.java.net/jdk/commit/7284f013
26-03-2021

STD->DST transition logic (beyond year 2037) is incorrect.
24-03-2021

Not observed with java.time: ``` jshell> ZonedDateTime.of(2038, 3, 14, 1, 30, 0, 0, z) $59 ==> 2038-03-14T01:30-05:00[America/New_York] jshell> ZonedDateTime.of(2038, 3, 14, 2, 30, 0, 0, z) $60 ==> 2038-03-14T03:30-04:00[America/New_York] ```
01-03-2021