This method can round nanos or output them in scientific notation.
=== Here is the minimized test demonstrating the bug ===
import java.sql.Timestamp;
class java_sql_Timestamp1 {
public static void main (String args[]) {
Timestamp t1=new java.sql.Timestamp(96,8,13,5,8,13,2);
System.out.println(t1);
//will print "1996-09-13 05:08:13.0E-9" instead of "1996-09-13 05:08:13.000000002"
Timestamp t2=new java.sql.Timestamp(96,8,13,5,8,13,499999998);
System.out.println(t2);
//will print "1996-09-13 05:08:13.5" instead of "1996-09-13 05:08:13.499999998 "
}
}
=== Here is the test output ===
1996-09-13 05:08:13.0E-9
1996-09-13 05:08:13.5
=== Here is the minimized test demonstrating the bug ===
import java.sql.Timestamp;
class java_sql_Timestamp1 {
public static void main (String args[]) {
Timestamp t1=new java.sql.Timestamp(96,8,13,5,8,13,2);
System.out.println(t1);
//will print "1996-09-13 05:08:13.0E-9" instead of "1996-09-13 05:08:13.000000002"
Timestamp t2=new java.sql.Timestamp(96,8,13,5,8,13,499999998);
System.out.println(t2);
//will print "1996-09-13 05:08:13.5" instead of "1996-09-13 05:08:13.499999998 "
}
}
=== Here is the test output ===
1996-09-13 05:08:13.0E-9
1996-09-13 05:08:13.5