aherlambang aherlambang - 6 months ago 14
PHP Question

creating new Date Time from string

I have a string which is:


and I wanted to create a new Date Time object from this, so I did:

new \DateTime('23/05/2013');

Any idea why I am getting this error all the time:

DateTime::__construct(): Failed to parse time string (23/05/2013) at position 0 (2): Unexpected character


According to http://www.php.net/manual/en/datetime.formats.date.php

Its mm/dd/yyyy, which is American, not British


DateTime::createFromFormat('d/m/Y', '23/05/2013');