create table mydate(
id int,
seqdate date
)
insert into mydate values(1, to_date('21-08-2003 20:28:03','DD-MM-YYYY HH24:MI:SS'));
insert into mydate values(2, to_date('22-08-2003 20:28:03','DD-MM-YYYY HH24:MI:SS'));
insert into mydate values(3, to_date('23-08-2003 20:28:03','DD-MM-YYYY HH24:MI:SS'));
insert into mydate values(4, to_date('24-08-2003 20:28:03','DD-MM-YYYY HH24:MI:SS'));
commit;
select id,to_char(seqdate, 'DD-MM-YYYY HH24:MI:SS') seqdate from mydate
spring-jdbctemplate-date:
public Date queryForDate(String sql, Object... args) { try { Date result = this.getJdbcTemplate().queryForObject(sql, args, Date.class); return result; } catch (EmptyResultDataAccessException e) { return null; } } public Date getDate(int id) { String sql = "select seqdate from mydate where id = ?"; return jdbctemplate.queryForDate(sql, new Object[] { id }); }