(PHP 5 >= 5.5.0, PHP 7, PHP 8)
Representation of date and time.
This class behaves the same as DateTime except new objects are returned when modification methods such as DateTime::modify() are called.
message: "as DateTimeImmutable::add() does not modify the object itself")]$interval): DateTimeImmutable$format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|falsemessage: "as DateTimeImmutable::modify() does not modify the object itself")]$modifier): DateTimeImmutablemessage: "as DateTimeImmutable::setDate() does not modify the object itself")]$year, int $month, int $day): DateTimeImmutablemessage: "as DateTimeImmutable::setISODate() does not modify the object itself")]$year, int $week, int $dayOfWeek = 1): DateTimeImmutablemessage: "as DateTimeImmutable::setMicrosecond() does not modify the object itself")]$microsecond): staticmessage: "as DateTimeImmutable::setTime() does not modify the object itself")]$hour,$minute,$second = 0,$microsecond = 0message: "as DateTimeImmutable::setTimestamp() does not modify the object itself")]$timestamp): DateTimeImmutablemessage: "as DateTimeImmutable::setTimezone() does not modify the object itself")]$timezone): DateTimeImmutablemessage: "as DateTimeImmutable::sub() does not modify the object itself")]$interval): DateTimeImmutablesince: '8.5',message: 'this method is obsolete, as serialization hooks are provided by __unserialize() and __serialize()',
| Version | Description |
|---|---|
| 8.4.0 | The class constants are now typed. |
| 7.1.0 |
The DateTimeImmutable constructor now includes the
current microseconds in the constructed value. Before this, it would
always initialise the microseconds to 0.
|