I have a string which is \'23/05/2013\' and I wanted to create a new Date Time object from this, so I did:
new \\DateTime(\'23/05/2013\');
If you want to use the object normally rather than statically try this:
$datetime = new DateTime(); $newDate = $datetime->createFromFormat('d/m/Y', '23/05/2013');
then you can use it like normal:
echo $newDate->format('Y-m-d');