Oracle日期到Java日期 [英] Oracle date to Java date
问题描述
我正在使用这个SimpleDateFormat。
SimpleDateFormat dateFormat = new SimpleDateFormat(yyyy / mm / dd hh:mm:ss.sss);
它给出了这个异常。
java.text.ParseException:不可稀释的日期:2011-08-19 06:11:03.0
请告诉我要使用的SimpleDateFormat。谢谢。
你应该使用这个模式yyyy-MM-dd HH:mm:ss。 S
而不是yyyy / mm / dd hh:mm:ss.sss
。
$ b $ 小时在上午/下午(1-12)和
H
中的小时 h 在日(0-23)
请看这里: SimpleDateFormat SimpleDateFormat dateFormat = new SimpleDateFormat(yyyy-MM-dd HH:mm: ss.S);
日期date = dateFormat.parse(2011-08-19 06:11:03.0);
What SimpleDateFormat to use for parsing Oracle date ?
I'm using this SimpleDateFormat.
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/mm/dd hh:mm:ss.sss");
its giving this exception.
java.text.ParseException: Unparseable date: "2011-08-19 06:11:03.0"
Kindly please tell me the SimpleDateFormat to use. Thanks.
解决方案 You should use this Pattern "yyyy-MM-dd HH:mm:ss.S"
instead of "yyyy/mm/dd hh:mm:ss.sss"
.
little h
for "Hour in am/pm (1-12)" and H
for "Hour in day (0-23)"
see here: SimpleDateFormat
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
Date date = dateFormat.parse("2011-08-19 06:11:03.0");
这篇关于Oracle日期到Java日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!