Oracle TIMESTAMP的处理

时间:2014-07-19 08:00:40   收藏:0   阅读:209
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

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!