OracleTIMESTAMP的處理
public class Test {
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:dd");
public static void main(String[] args) throws SQLException {
oracle.sql.TIMESTAMP temp = new oracle.sql.TIMESTAMP();
System.out.println(convertOrclTimestemp2String(temp, null));
}
public static String convertOrclTimestemp2String(oracle.sql.TIMESTAMP temp, String pattern) throws SQLException {
java.sql.Timestamp tt = (java.sql.Timestamp) temp.toJdbc();
if(StringUtils.isNotBlank(pattern)) {
FORMAT.applyPattern(pattern);
}
return FORMAT.format(new Date(tt.getTime()));
}
}
輸出結果:1970-01-01 00:00:01