date_create

Its an alias of DateTime::__construct() and creates new DateTime object .
Example

<?php
$date = date_create(‘2007-5-17’);
if (!$date) {
$e = date_get_last_errors();
foreach ($e[‘errors’] as $error) {
echo “$errorn”;
}
exit(1);
}
echo date_format($date, ‘Y-m-d’);
?>

Output

2007-05-15