When a String value with fractional seconds is passed to java.sql.Timestamp.valueOf() method , where the fractional seconds length is less than 6, the valueOf method adds trailing zeros which changes the value of the fractional string.
public class TimestampTest {
public static void main(String[] args) {
Timestamp t = Timestamp.valueOf("2005-1-01 10:20:50.11");
}
}
valueOf - returns nano seconds as - 110000000 - which is not the original value.
This should instead add leading zeros as done in case of toString() method.
I am expecting output Just '11' or '000000011'
Can someone tell me if my understanding is right or I am mistaking some where.