date_date_set

Its an alias of DateTime::setDate() and sets the date.

Example

<?php
$date = date_create();
date_date_set($date, 2011, 5, 17);
echo date_format($date, ‘Y-m-d’);
?>

echo $date->format(‘Y-m-d’);
?>
Output

2011-05-17

Share