如何将带有时区的 PostgreSQL 时间戳转换为 Java Instant 或 OffSetDateTime?
具有时区格式的 PostgreSQL 时间戳:2020-06-18 16:15:38+05:30
在 Java 11.7 中获得以下异常 - Ubuntu forInstant.parse("2020-06-18 16:15:38+05:30".replace(" ", "T"))
Exception in thread "main" java.time.format.DateTimeParseException: Text '2020-06-18T16:15:38+05:30' could not be parsed at index 19
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2046)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1948)
at java.base/java.time.Instant.parse(Instant.java:395)
at OffSetDateTimeExample.main(OffSetDateTimeExample.java:9)
但它适用于 Java 13。
使其在 Java 11 中工作的任何帮助