note 118990 deleted from datetimeimmutable.createfrommutable by peehaa
| From: | peehaa@php.net | Date: | Fri, 09 Dec 2016 22:38:48 +0000 |
| Subject: | note 118990 deleted from datetimeimmutable.createfrommutable by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-208369@lists.php.net to get a copy of this message | ||
Note Submitter: woody dot gilk at gmail dot com
----
Here's a polyfill for PHP <= 5.6:
<?php
function datetime_create_from_mutable(DateTime $date)
{
return DateTimeImmutable::createFromFormat(
'U',
$date->getTimestamp(),
$date->getTimezone()
);
}
?>