相关疑难解决方法(0)

在Java中将字符串转换为OffsetDateTime

我正在尝试转换字符串,OffsetDateTime但低于错误.

java.time.format.DateTimeParseException: Text '20150101' could not be parsed: Unable to obtain OffsetDateTime from TemporalAccessor: {},ISO resolved to 2015-01-01 of type java.time.format.Parsed

代码: OffsetDateTime.parse("20150101", DateTimeFormatter.ofPattern("yyyyMMdd"));

预期产量: OffsetDateTime object with date 20150101.

我非常感谢您提供的任何帮助.

谢谢,

java string datetime date java-8

3
推荐指数
2
解决办法
2万
查看次数

标签 统计

date ×1

datetime ×1

java ×1

java-8 ×1

string ×1