ZonedDateTime.of
- ZonedDateTime of(LocalDate date, LocalTime time, ZoneId zone)
- ZonedDateTime of(LocalDateTime localDateTime, ZoneId zone)
- ZonedDateTime of(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone)
- ZonedDateTime of(int year, Month month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond, ZoneId zone)
Obtains an instance of {@code ZonedDateTime} from a local date-time. !(p) This creates a zoned date-time matching the input local date-time as closely as possible. Time-zone rules, such as daylight savings, mean that not every local date-time is valid for the specified zone, thus the local date-time may be adjusted. !(p) The local date-time is resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the {@link ZoneRules rules} of the zone ID. !(p) In most cases, there is only one valid offset for a local date-time. In the case of an overlap, when clocks are set back, there are two valid offsets. This method uses the earlier offset typically corresponding to "summer". !(p) In the case of a gap, when clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer".
@param localDateTime the local date-time, not null @param zone the time-zone, not null @return the zoned date-time, not null