getTimestamp public Timestamp getTimestamp(int columnIndex) throws SQLException Gets the value of a column in the current row as a java.sql.Timestamp object. Parameters: columnIndex - the first column is 1, the second is 2, ... Returns: the column value; if the value is SQL NULL, the result is null Throws: SQLException - if a database access error occurs public static String GetDateStr(java.sql.Timestamp rDate, String rDateFormat) { SimpleDateFormat lFormat; lFormat = new SimpleDateFormat(rDateFormat); gRtnStr = lFormat.format(rDate);
可能需要调用的方法是getYear(),getMonth,getDate..
不过这几个方法已经是sun不提倡使用的方法了,编译的时候会有Warning.
public Timestamp getTimestamp(int columnIndex)
throws SQLException
Gets the value of a column in the current row as a java.sql.Timestamp object.
Parameters:
columnIndex - the first column is 1, the second is 2, ...
Returns:
the column value; if the value is SQL NULL, the result is null
Throws:
SQLException - if a database access error occurs
public static String GetDateStr(java.sql.Timestamp rDate, String rDateFormat) {
SimpleDateFormat lFormat; lFormat = new SimpleDateFormat(rDateFormat);
gRtnStr = lFormat.format(rDate);
return gRtnStr;
}
http://www.csdn.net/develop/article/11/11147.shtm
http://www.csdn.net/develop/article/11/11145.shtm
You may use the DBMS function .