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

No Midnight in TimeZone for Europe/Istanbul in 1880

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8u45, 9
    • core-libs
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      1.8.0_45

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7, 64 bit

      A DESCRIPTION OF THE PROBLEM :
              DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss:n");
              ZoneId zone = ZoneId.of("Europe/Istanbul");
              ZonedDateTime start = ZonedDateTime.of(LocalDate.of(1880, Month.JUNE, 12).atStartOfDay(), zone);
      start = start.with(TemporalAdjusters.firstDayOfYear()).withHour(0).withMinute(0).withSecond(0).withNano(0);
      System.out.println(formatter.format(start));

      Above code prints:
      01 January 1880 00:02:04:0 instead of 01 January 1880 00:00:00:0

      Same code works for other years before ...1879, 1881... etc; as expected.
      What is wrong with year 1880.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the code lines about

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      01 January 1880 00:00:00:0

      ACTUAL -
      01 January 1880 00:02:04:0

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
              DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy HH:mm:ss:n");
              ZoneId zone = ZoneId.of("Europe/Istanbul");
              ZonedDateTime start = ZonedDateTime.of(LocalDate.of(1880, Month.JUNE, 12).atStartOfDay(), zone);
      start = start.with(TemporalAdjusters.firstDayOfYear()).withHour(0).withMinute(0).withSecond(0).withNano(0);
      System.out.println(formatter.format(start));


      ---------- END SOURCE ----------

            rriggs Roger Riggs
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: