java.sql.Date.toString is broken for years < 1000 and years > 9999

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 1.3.1_04
    • Affects Version/s: 1.3.1
    • Component/s: core-libs
    • 04
    • generic
    • generic



      Name: bsT130419 Date: 10/04/2001


      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)


      java.sql.Date.toString() is broken
      on all platforms & versions of the JRE.

      If the Date falls in a year before 1000
      or after 9999 then it produces an
      incorrectly formatted String representation.
      The specification of the String format
      (and that expected by DB2 JDBC drivers for
      example) is "yyyy-mm-dd". Unfortunately the
      current implementation only works if the
      year is >= 1000 and <= 9999.

      The fix is extremely simple; line 124 of
      java/sql/Date.java needs to pad the string
      with leading zeros.
      (Review ID: 133152)
      ======================================================================

            Assignee:
            Jonathan Bruce (Inactive)
            Reporter:
            Bill Strathearn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: