I am trying to report how many hours are remaining of a users subscription. The format of date/time which I am using is Y-m-d H:i:s
. Basically I log the time the user pays in the database, and assume the plan will expire 1 day from when the payment was made.
What is wrong with my logic here in the calculation of difference between the current time and the end date?
$start_time = strtotime($callback->_time_paid());
$end_time = 0;
$end_time = strtotime(date('Y-m-d H:i:s', strtotime($callback->_time_paid().(' +'.$days. 'day'))));
$static = ($end_time - $start_time);
$time = (strtotime(date('Y-m-d H:i:s')) - $static) - $static;
print_r($time);
$hours = floor($time / 3600);
$minutes = floor($time / 60);