Ejemplo n.º 1
0
 /**
  * Returns a copy of this {@code OffsetDateTime} with the specified number of hours added.
  * <p>
  * This instance is immutable and unaffected by this method call.
  *
  * @param int $hours the hours to add, may be negative
  * @return OffsetDateTime an {@code OffsetDateTime} based on this date-time with the hours added, not null
  * @throws DateTimeException if the result exceeds the supported date range
  */
 public function plusHours($hours)
 {
     return $this->_with($this->dateTime->plusHours($hours), $this->offset);
 }
Ejemplo n.º 2
0
 /**
  * Returns a copy of this {@code ZonedDateTime} with the specified number of hours added.
  * <p>
  * This operates on the instant time-line, such that adding one hour will
  * always be a duration of one hour later.
  * This may cause the local date-time to change by an amount other than one hour.
  * Note that this is a different approach to that used by days, months and years,
  * thus adding one day is not the same as adding 24 hours.
  * <p>
  * For example, consider a time-zone where the spring DST cutover means that the
  * local times 01:00 to 01:59 occur twice changing from offset +02:00 to +01:00.
  * <ul>
  * <li>Adding one hour to 00:30+02:00 will result in 01:30+02:00
  * <li>Adding one hour to 01:30+02:00 will result in 01:30+01:00
  * <li>Adding one hour to 01:30+01:00 will result in 02:30+01:00
  * <li>Adding three hours to 00:30+02:00 will result in 02:30+01:00
  * </ul>
  * <p>
  * This instance is immutable and unaffected by this method call.
  *
  * @param int $hours the hours to add, may be negative
  * @return ZonedDateTime a {@code ZonedDateTime} based on this date-time with the hours added, not null
  * @throws DateTimeException if the result exceeds the supported date range
  */
 public function plusHours($hours)
 {
     return $this->resolveInstant($this->dateTime->plusHours($hours));
 }