All Forums General
muthu1802 20 posts Joined 01/12
16 Mar 2014
.0 is appending at lat of timestamp value while fetching using java JDBC

in table I am having a value timestamp "2014-03-15 06:12:35". But while selecting using java JDBC I am getting "2014-03-15 06:12:35.0".
I tried both resultSet.getString and resultSet.getTimestamp
How to resolve this issue. Please advice.

rpc1 2 posts Joined 03/14
17 Mar 2014

It is not a problem, you get valid timestamp and can use it  in the next java code.  java.sql.Timestamp represents the timestamp (year, month, day, hour, minute, second, millisecond) and  '0' is default value for milliseconds. 
Terradata allowes set the  timestamp(n) data type where  n  is the number of digits in the fractional part of second (if you need milliseconds set type timestamp(3))

tomnolan 594 posts Joined 01/08
17 Mar 2014

The JDK built-in method java.sql.Timestamp.toString prints the Timestamp value with the trailing ".0"
That is not under the control of the database or the JDBC Driver.
What exactly is the problem? You don't like the trailing ".0" ?

muthu1802 20 posts Joined 01/12
26 Mar 2014

Yes. I dont need a trailing ".0".
I have formatted the timestamp as below and it worked for me,
SimpleDateFormat dateFormat = new SimpleDateFormat(

"yyyy-MM-dd HH:mm:ss");




You must sign in to leave a comment.