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

SimpleDateFormat parsing "yyyy-M-dHH:mm:ss" error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 8, 11, 17
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      A DESCRIPTION OF THE PROBLEM :
      code:
      String date = "2021-2-23";
      String time = "09:30:31";
      System.out.println(new SimpleDateFormat("yyyy-M-dHH:mm:ss").parse(date+time));
      System.out.println(new SimpleDateFormat("yyyy-M-d HH:mm:ss").parse(date+" "+time));
      System.out.println(System.getProperty("java.version"));


      output:
      Sun Feb 14 21:30:31 CST 2021
      Tue Feb 23 09:30:31 CST 2021
      11.0.11

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            naoto Naoto Sato
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: