addWeeks.php
Table of Contents
Functions
- addWeeks() : DateTimeImmutable
- Returns a copy of a date shifted by a number of weeks.
Functions
addWeeks()
Returns a copy of a date shifted by a number of weeks.
addWeeks(DateTimeInterface $date, int $weeks) : DateTimeImmutable
A new DateTimeImmutable is returned ; the source date is never modified. This is
calendar arithmetic, equivalent to addDays( $date , $weeks * 7 ) : the wall-clock
time of day is preserved, so across a DST transition the shift can differ from the
same span expressed in hours (see addHours()). A negative $weeks shifts the date
backwards.
Parameters
- $date : DateTimeInterface
-
The source date.
- $weeks : int
-
The number of weeks to add (negative to subtract).
Tags
Return values
DateTimeImmutable —A new immutable date shifted by $weeks weeks.