DateTime::createFromFormat()

It displays new DateTime object with the specified format
Example

<?php
$date = DateTime::createFromFormat(‘j-M-Y’, ’17-May-2012′);
echo $date->format(‘Y-m-d’);
?>

Output

2012-05-17