Example #1
0
 /**
  * Combines this date-time with a time-zone to create a {@code ZonedDateTime}
  * ensuring that the result has the same instant.
  * <p>
  * This returns a {@code ZonedDateTime} formed from this date-time and the specified time-zone.
  * This conversion will ignore the visible local date-time and use the underlying instant instead.
  * This avoids any problems with local time-line gaps or overlaps.
  * The result might have different values for fields such as hour, minute an even day.
  * <p>
  * To attempt to retain the values of the fields, use {@link #atZoneSimilarLocal(ZoneId)}.
  * To use the offset as the zone ID, use {@link #toZonedDateTime()}.
  *
  * @param ZoneId $zone the time-zone to use, not null
  * @return ZonedDateTime the zoned date-time formed from this date-time, not null
  */
 public function atZoneSameInstant(ZoneId $zone)
 {
     return ZonedDateTime::ofInstantWithOffset($this->dateTime, $this->offset, $zone);
 }