Last active
December 24, 2019 10:19
-
-
Save Songmu/5f6960765ae618dfdfb76e9c2406d7af to your computer and use it in GitHub Desktop.
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 | |
$date_str = '2017-07-25T15:26:16.12+02:00'; | |
$date_str = preg_replace('/^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2})(?:(\\.\\d{6})\\d*)?(.*)/', '$1$2$3', $date_str); | |
$d = DateTime::createFromFormat("Y-m-d\TH:i:s.uP", $date_str); | |
var_dump($d); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment