<?php
$date = new \DateTime('2015-01-26 14:55:30');
var_dump(\DateTime::createFromFormat('c', $date->format('c')), DateTime::getLastErrors());
- Output for 5.5.0 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
- bool(false)
array(4) {
["warning_count"]=>
int(0)
["warnings"]=>
array(0) {
}
["error_count"]=>
int(2)
["errors"]=>
array(2) {
[0]=>
string(35) "The format separator does not match"
[1]=>
string(13) "Trailing data"
}
}
preferences:
56.13 ms | 409 KiB | 5 Q