Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8262110

DST starts from incorrect time in 2038

    XMLWordPrintable

    Details

      Backports

        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

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                naoto Naoto Sato
                Reporter:
                shadowbug Shadow Bug
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: