simple singularities

ResultSet getDate(), getTime(), getTimestamp()

Filed under: java, programming — fri13th January 20, 2007 @ 4:17 pm

though it’s a very basic one, i think there’s few caution about this. if you want to get date object from mysql, you may use like this..

new Date(rs.getTimestamp("date_field").getTime());

not

rs.getDate("date_field");

you get only date info from the latter one.
you can get time field like this.

rs.getTime("date_field");

that’s all, and that’s why we need hibernate or something..
always be careful..

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment