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

SimpleDateFormat incorrectly formats 1900-01-01 08:00:00

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 16
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows(maybe not only)

      A DESCRIPTION OF THE PROBLEM :
      when format 1900-01-01 08:00:00 ,something strange happened

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
              SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
              try {
                  System.out.println(format.format(format.parse("1900-01-01 08:00:00")));
              } catch (ParseException e) {
                  e.printStackTrace();
              }

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1900-01-01 08:00:00
      ACTUAL -
      1900-01-01 08:05:43

      ---------- BEGIN SOURCE ----------
              SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
              try {
                  System.out.println(format.format(format.parse("1900-01-01 08:00:00")));
              } catch (ParseException e) {
                  e.printStackTrace();
              }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tongwan Andrew Wang
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: