【发布时间】:2019-04-23 08:56:16
【问题描述】:
使用以下格式化程序,我可以解析 "2017-03-28T23:40:06.000+0100"
new DateTimeFormatterBuilder()
.append(ISO_LOCAL_DATE_TIME)
.appendPattern("X")
.toFormatter();
它解析另一个"2017-03-28T23:40:06.000+01:00"
new DateTimeFormatterBuilder()
.append(ISO_LOCAL_DATE_TIME)
.appendPattern("XX")
.toFormatter();
但是,我无法指定同时解析两者的格式化程序。我应该附加什么模式?
格式化程序还应该能够处理没有区域偏移的时间戳,例如"2017-03-28T23:40:06.000Z"
【问题讨论】: