Monday 15 July 2013

java - Select date query with time format is not working with JDBCTemplate and util.Date -


I am using Spring JDBCTripplate in relation to DB.

Select DD-MM-YYYY HH24: MI: SS ').

> Output is, 31-12-99 23:59:59.

However, when I am using it below with JDBCcittlet,

  date d = jdbc template QueryForObject ("from composition" DD-MM-Y YHH 24 : MI: Select for "SS" (valid_date ", date.class);   

outpt is 2099-12-31 00: 00: 00.0.

Time is not correct, I need the same time in the date class. How to get it?

You need to use the java.sql.Timestamp . java.sql.Date There is no time component, so it is always 00:00:00.

No comments:

Post a Comment