DateTime::setDate()

It sets the date .Example

<?php
$date = new DateTime();
$date->setDate(2011, 5, 17);
echo $date->format(‘Y-m-d’);
?>

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

Output

2011-05-17