Coffee to go

Icon

var thisBlog = getGlobalContext().buildFromTemplate(PERSONAL | PROGRAMMING | RANDOM_THOUGHTS);

java – ResultSet.getTimestamp() = Date + Time

Fall into this again, now not to forget this again I am posting it here.

ResultSet.getDate() returns date without time i.e. If table column has date time value say 2011-01-01 12:05:01 then the output of ResultSet.getDate() will be 2011-01-01.

And if in case complete date time value is required use ResultSet.getTimestamp() instead. The output will be complete date with time 2011-01-01 12:05:01

ResultSet rs = ...;
rs.getDate("columnName"); //value will be date without time
rs.getTimestamp("columnName"); //value will be date *with* time
Share on Twitter

Category: Uncategorized

Tagged:

Leave a Reply