Oracle TIMESTAMP的处理

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

Oracle TIMESTAMP的处理,布布扣,bubuko.com

Oracle TIMESTAMP的处理

上一篇:获取Oracle数据库中字段信息


下一篇:Oracle VM VirtualBox安裝Windows 2000失败