private String getDate(Object value) {
Timestamp timestamp = null;
try {
timestamp = (Timestamp) value;
} catch (Exception e) {
timestamp = getOracleTimestamp(value);
}
if(timestamp!=null)
return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S")) .format(timestamp);
else return null;
}
/**
* @reference oracle.sql.Datum.timestampValue();
* @return
*/
private Timestamp getOracleTimestamp(Object value) {
try {
Class clz = value.getClass();
Method m = clz.getMethod("timestampValue", null);
//m = clz.getMethod("timeValue", null); 时间类型
//m = clz.getMethod("dateValue", null); 日期类型
return (Timestamp) m.invoke(value, null);
} catch (Exception e) {
return null;
}
}