java.text.ParseException:不可稀释的日期“yyyy-MM-dd'T'HH:mm:ss.SSSZ” - SimpleDateFormat [英] java.text.ParseException: Unparseable date "yyyy-MM-dd'T'HH:mm:ss.SSSZ" - SimpleDateFormat
本文介绍了java.text.ParseException:不可稀释的日期“yyyy-MM-dd'T'HH:mm:ss.SSSZ” - SimpleDateFormat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很感激任何帮助找到这个例外的错误:
I would appreciate any help with finding bug for this exception:
java.text.ParseException: Unparseable date: "2007-09-25T15:40:51.0000000Z"
和以下代码:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
Date date = sdf.parse(timeValue);
long mills = date.getTime();
this.point.time = String.valueOf(mills);
它引发expcetion与 Date date = sdf.parse(timeValue) / code>。
It throws expcetion with Date date = sdf.parse(timeValue);
.
timeValue =2007-09-25T15:40:51.0000000Z;
,如例外。
谢谢。
推荐答案
Z
表示时区字符。它需要引用:
Z
represents the timezone character. It needs to be quoted:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
这篇关于java.text.ParseException:不可稀释的日期“yyyy-MM-dd'T'HH:mm:ss.SSSZ” - SimpleDateFormat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文