My code:
Calendar c = Calendar.getInstance();
c.setTime(res.getDate("my_date")); //res is ResultSet
System.out.println(c.getTime());
System.out.println(res.getString("my_date"));
Output:
Thu Oct 11 00:00:00 IST 2012
2012-10-11 02:50:00.0
In calendar, it is not considering the time part. I used Calendar because I have to make some comparisons.
Why time part is omitted?
You should use something like :
By the way, you have to create a SimpleDateFormat that fit your SQL date format.