I have a function that converts long-date times to human readable format. However i need to add an hour to those times. Below is what i tired but it does not work. My original function is found below that, which does work but does not add the additional 1 hour to the time.
Not working adding an additional hour function
date_default_timezone_set('Europe/London');
$date = date('Y-m-d');
function convertDateTime($datestamp) {
$dt = new DateTime("@$datestamp");
$newdate= $dt->format('Y-m-d H:i:s');
return $newdate("+1 hour");
}
Working function that does not add hour to the output
date_default_timezone_set('Europe/London');
$date = date('Y-m-d');
function convertDateTime($datestamp) {
$dt = new DateTime("@$datestamp");
$newdate= $dt->format('Y-m-d H:i:s');
return $newdate;