Create Immutable version of DateTime from Mutable prior PHP 5.6

suggest change

To create \DateTimeImmutable in PHP 5.6+ use:

\DateTimeImmutable::createFromMutable($concrete);

Prior PHP 5.6 you can use:

\DateTimeImmutable::createFromFormat(\DateTime::ISO8601, $mutable->format(\DateTime::ISO8601), $mutable->getTimezone());

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents