为什么 LocalDateTime 没有区域?

Why does a LocalDateTime not have a zone?

我不明白这一点 - 根据定义,LocalDateTime 在我的默认时区内 - 对吗?那么为什么我需要提供一个区域来从 LocalDateTime 转换为 ZonedDateTime?

A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.

因为起的不是特别好。它只是一个没有时区的 DateTime 和一个 "clock" 时间,按照: This class does not store or represent a time-zone. Instead, it is a description of the date, as used for birthdays, combined with the local time as seen on a wall clock. It cannot represent an instant on the time-line without additional information such as an offset or time-zone.

因此,要转换为 ZonedDateTime,您需要提供上下文。

来源:https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html