问题标签 [threetenabp]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
java - org.threeten.bp.format.DateTimeParseException:文本'Sat Sep 19 2020 07:14 AM PDT' 无法在 $.root.bsa[0].posted 的索引 25 处解析
我正在尝试将一个看起来像这样的日期解析
Sat Sep 19 2020 07:14 AM PDT
为ZonedDateTime
.
我正在使用这个格式化程序
我正在尝试将字符串转换为
但是,这会引发以下异常:
org.threeten.bp.format.DateTimeParseException: Text 'Sat Sep 19 2020 07:14 AM PDT' could not be parsed at index 25 at $.root.bsa[0].posted
我不太确定日期格式字符串中的错误在哪里:我已经通过http://www.fileformat.info/tip/java/simpledateformat.html对其进行了验证,但看起来格式正确那里。
附加上下文:此代码正在 Moshi 适配器中执行,并且正在 Android 应用程序中运行:
android - ThreeTenABP DateTime 解析器为 yyyy-MM-ddTHH:mm:ss 格式提供异常
我需要将 dateTime 转换为String
毫秒,并且为此使用 ThreeTenABP,但是OffSetDateTime.parse
无法解析String
用于 ex 的 dateTime。"2020-08-14T20:05:00"
并给出以下例外。
我已经搜索了类似的问题,但找不到确切的解决方案。
下面是我在 Kotlin 中使用的代码。