I'm trying to parse following string:
Thu Oct 03 2013 07:03:41 GMT+0200 (Central Europe Standard Time)
But I'm struggling to find the corresponding format, I tried:
$date= DateTime::createFromFormat('D M d Y H:i:s eO (*)','Thu Oct 03 2013 07:03:41 GMT+0200 (Central Europe Standard Time)');
echo $date->format('Y-m-d');
Which results in error. Problem is, that there is no space between GMT+0200 and the brackets. Following works just fine
$date= DateTime::createFromFormat('D M d Y H:i:s e O','Thu Oct 03 2013 07:03:41 GMT +0200');
echo $date->format('Y-m-d');
But (obviously) I should be able to parse also the first example. So do you have any suggestion how the correct format should look like?
the error I get:
Fatal error: Call to a member function format() on a non-object in C:....
var_dump of $date before calling $date->format:
boolean false
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…