Last active
May 21, 2017 17:41
-
-
Save frankdejonge/fff3cdc43c6e7bf3fe83ba4d7b4b2c51 to your computer and use it in GitHub Desktop.
Mirco-time precise DateTime(Immutable) instances.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mirco_time_precise_date_time_immutable() | |
{ | |
return DateTimeImmutable::createFromFormat('U.u', sprintf('%.6F', microtime(true))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that the time zone will not be set to the current time zone, it will default to "+00:00". This is a side-effect from creating a DateTime(Immutable) from a timestamp.