DateTime::setTimestamp
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
Sets the date and time based on an Unix timestamp
Description
Oop
Procedural
Sets the date and time based on an Unix timestamp.
Like DateTimeImmutable::setTimestamp but works with DateTime.
The procedural version takes the DateTime object as its first argument.
Parameters
timestampUnix timestamp representing the date. Setting timestamps outside the range of Integer is possible by using
DateTimeImmutable::modifywith the@format.
Return Values
Modifiedobject