I have the following variables:
$days_a = $array_total['days']; // This one display days
$hours_a = $array_total['hours']; // This one display hours
$minutes_a = $array_total['minutes']; // This one display minutes
$seconds_a = $array_total['seconds']; // This one display seconds
These variables give me the current session time, here all works.
Now the problem...
I have then these variables:
$days_f = $fetch_s['days'];
$hours_f = $fetch_s['hours'];
$minutes_f = $fetch_s['minutes'];
$seconds_f = $fetch_s['seconds'];
These display the time that the user entered in the website previously, they took the values from the database... I did this for add the current session variable values to the values in the MySQL Db:
$days_2 = $days_a + $days_f;
$hours_2 = $hours_a + $hours_f;
$minutes_2 = $minutes_a + $minutes_f;
$seconds_2 = $seconds_a + $seconds_f;
But I need that each 60 seconds it add 1 to $minutes_2 , each 60 minutes it add 1 to $hours_2 and each 24 hours it add 1 to $days_2
For example if I have 118 seconds I need that it adds 1 to $minutes_2 and set the variable $seconds_2 to 58 etc...
How can this be done?
I tried something like that:
$seconds = $seconds_2 % 60;
$minutes_3 = $seconds_2 / 60;
$minutes = $minutes_3 % 60;
$hours_3 = $minutes / 60;
$hours = $hours_3 % 24;
$days = $hours / 24;
$days = (int)$days_int;
But this won't work... Someone know how do that in a similar or different way?
Could someone give me the code? Please