Im working on a uni project for a simple car rental system. My problem comes in when calculating time (the amount of days and hours for the car rental)
Right now the time (where I am) is 12:15 PM
CODE:
//Test Variables
$ciDate = '2016-08-28';
$ciTime = '13:10';
//calc Time
$calcDate = $ciDate.$ciTime;
$calcDate = strtotime($calcDate);
$remaining = $calcDate - time();
$days_remaining = floor($remaining / 86400);
$hours_remaining = floor(($remaining % 86400) / 3600);
$totPrice = $days_remaining * 4;
//Disp Result
echo $days_remaining. ' Days and ' . $hours_remaining. ' hours';
MY PROBLEM
When the above code gets executed, I get back 2 Days and 5 hours, which is incorrect considering my time now is 12:15 PM 2016/08/26
I'm going to go out on a limb here and guess the problem is due to server time being different than my current time?
Any suggestions on how to fix the above problem, much appreciated.
EDIT:
At the time of writing the correct result should be 2 days and 1 hour