jdbc에서 resultSet.getDate() 하면 new java.util.Date();
- 시간, 분, 초 정보는 가지고 있지 않다.
ResultSet 의 메소드를 살펴 보면.
java.sql.ResultSet
public abstract Date getDate(String columnName) throws SQLException
Get the value of a column in the current row as a java.sql.Date object.
Returns: the column value; if the value is SQL NULL, the result is null
public abstract Time getTime(String columnName) throws SQLException
Get the value of a column in the current row as a java.sql.Time object.
Returns: the column value; if the value is SQL NULL, the result is null
getDate() 나 getTime() 은 java.util.Date 객체를 반환하는 것이 아니라
java.sql 패키지의 java.sql.Date와 java.sql.Time 객체를 반환하고 있습니다.
반면
public abstract Timestamp getTimestamp(String columnName) throws SQLException
Get the value of a column in the current row as a java.sql.Timestamp object.
Returns: the column value; if the value is SQL NULL, the result is null
getTimestamp() 는 "java.sql.Date, java.sql.Time, java.sql.Timestamp 는 java.util.Date를 상속받아서
모든 정보를 가지고 있다.
2009.10.21 00:00:00 <-- rs.getDate()
1970.01.01 01:15:38 <-- rs.getTime()
2009.10.21 01:15:38 <-- rs.getTimestamp()