addSeconds.php
Table of Contents
Functions
- addSeconds() : DateTimeImmutable
- Returns a copy of a date shifted by a number of seconds.
Functions
addSeconds()
Returns a copy of a date shifted by a number of seconds.
addSeconds(DateTimeInterface $date, int $seconds) : DateTimeImmutable
A new DateTimeImmutable is returned ; the source date is never modified. This is
absolute-duration (elapsed-time) arithmetic : across a DST transition, addSeconds()
shifts by exactly that many real seconds, which can land on a different wall-clock
time than a calendar shift of the same nominal span (see addDays()). A negative
$seconds shifts the date backwards.
Parameters
- $date : DateTimeInterface
-
The source date.
- $seconds : int
-
The number of seconds to add (negative to subtract).
Tags
Return values
DateTimeImmutable —A new immutable date shifted by $seconds seconds.