DateTime::setTime

It sets the time
Example
<?php
$date = new DateTime(‘2001-05-17’);
$date->setTime(12, 52);
echo $date->format(‘Y-m-d H:i:s’);
?>

Output

2001-05-17 12:52:00

Share