java.sql.Timestamp
(as returned by getTimestamp
) includes a nanosecond component, and its toString()
method appends that nanosecond value to the end of the String. In your case, the nanosecond value is zero (your data only has one-second precision).
Note that while java.sql.Timestamp
is a subclass of java.util.Date
, you should be careful about treating it as such. From the Javadoc:
This type is a composite of a java.util.Date
and a separate nanoseconds value. Only integral seconds are stored in the java.util.Date
component. The fractional seconds - the nanos - are separate. The Timestamp.equals(Object)
method never returns true when passed an object that isn't an instance of java.sql.Timestamp
, because the nanos component of a date is unknown. As a result, the Timestamp.equals(Object)
method is not symmetric with respect to the java.util.Date.equals(Object)
method. Also, the hashcode method uses the underlying java.util.Date
implementation and therefore does not include nanos in its computation.
Due to the differences between the Timestamp
class and the java.util.Date
class mentioned above, it is recommended that code not view Timestamp
values generically as an instance of java.util.Date
. The inheritance relationship between Timestamp
and java.util.Date
really denotes implementation inheritance, and not type inheritance.