我想將字符串轉換爲ZonedDateTime。ZonedDateTime解析異常
我曾嘗試以下操作:
SimpleDateFormat zonedDateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
zonedDateTimeFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
long timeMs = zonedDateTimeFormat.parse("2017-07-18T20:26:28.582+03:00[Asia/Istanbul]").getTime();
它給java.text.ParseException: Unparseable date
如何可以解析以下字符串ZonedDateTime
2017-07-18T20:26:28.582+03:00[Asia/Istanbul]
你很不對。它不是一個ISO格式,因爲方括號中的尾隨區域標識符(但在API中稱爲「ISO _...」,在javadoc中有小的解釋性說明:「方括號中的部分不是ISO-8601標準「)。 –
@MenoHochschild非常感謝您的澄清。我不確定。 –