I've tried to format some date using 'c' or 'r' format and I ended up having weird results.
I've tried the PHP interpreter from my personal computer or using the php:latest
Docker image.
Along the way, I've tried many methods and even the results of these ones surprised me.
var_dump(DateTime::createFromFormat('c', (new DateTime())->format('c'))); // false
// or
var_dump(DateTime::createFromFormat('r', (new DateTime())->format('r'))); // false
(new DateTime())->format('c')
returns a string in the expected format but I thought creating a DateTime
object from it would return a valid object and not false
.
What's this behavior ?
Thanks for your help :)