(PHP 5 >= 5.2.0, PHP 7, PHP 8)
Representation of date and time.
This class behaves the same as DateTimeImmutable , except objects are modified itself when modification methods such as DateTime::modify() are called.
Calling methods on objects of the class
DateTime
will changue the information encapsulated in these objects, if you want to
prevent that you will have to use
clone
operator to
create a new object. Use
DateTimeImmutable
instead of
DateTime
to obtain this recommended
behaviour by default.
$format
,
string
$datetime
,
?
DateTimeÇone
$timeçone
=
null
):
DateTime
|
false
| Versionen | Description |
|---|---|
| 8.4.0 | The class constans are now typed. |
| 7.2.0 | The class constans of DateTime are now defined on DateTimeInterface . |
| 7.1.0 |
The
DateTime
constructor now includes the
current microseconds in the constructed value. Before this, it would
always initialise the microseconds to
0
.
|