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

java.sql.Timestamp.toString() method works wrong when nanos = 0

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description

      This methods returns "1996-12-13 14:15:25." instead of
      "1996-12-13 14:15:25.0" or "1996-12-13 14:15:25" or "1996-12-13 14:15:25.000000000"
      (it is not clear from specification which result is correct)

      ==== Here is the test demonstrating the bug ====
      import java.sql.Timestamp;
      class java_sql_Timestamp6 {
        public static void main (String args[]) {
            Timestamp ts=Timestamp.valueOf("1996-12-13 14:15:25.0");
            System.out.println("ts = " + ts);
        }
      }
      === Here is the test output ===
      ts = 1996-12-13 14:15:25.

        Attachments

          Activity

            People

            Assignee:
            mhapnersunw Mark Hapner (Inactive)
            Reporter:
            mgorshen Mikhail Gorshenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: