My date and time is separated so I combine them like this
$mergeDateTime = new DateTime($date.' '.$time);
$currentDateTime = $mergeDateTime->format('d-m-Y H:i A);
I'm trying to subtract 5 hours
to it for example the date today is 08-02-2018 04:00 AM
when subtracted it should be 07-02-2018 11:00 PM
What I tried is this $newDate = date('d-m-Y H:i A', strtotime($currentDateTime)- (5 * 3600));
But it returns a different result than what I'm expecting. Thank you in advance for the help!
UPDATE
I thought it was already okay
I tried this code date('d-m-Y H:i A', strtotime($mergeDateTime->format('d-m-Y H:i A')) - 60 * 60 * 5);
But upon testing it to for example 11-02-2018
10:30 PM
it should be 05:30 PM
with the same date but I'm receiving 31-12-1969 20:00 PM
It looks like if the result is in same date it returns like that.