day = sec / hr = sec / 60 / 60; min = (sec - horas * 3600) / 60; seg = sec % 60;
Tell me how to connect the days?
day = sec / hr = sec / 60 / 60; min = (sec - horas * 3600) / 60; seg = sec % 60;
Tell me how to connect the days?
1 day = 24 hours
1 hour = 60 minutes, i.e. 1 day = 24 * 60 minutes
1 minute = 60 seconds, i.e. 1 day = 24 * 60 * 60 seconds,
those. in X
seconds X / ( 24 * 60 * 60 )
days
usually you need to set the time in a specific format like dd: hh: mm: ss, and not just the number of minutes or seconds
Is logical Then we calculate the remains:
D = 24 * 60 * 60
H = 60 * 60
M = 60
XD = X / D
daysXH = ( X - XD * D ) / H
hoursXM = ( X - XD * D - XH * H ) / M
minutesXS = ( X - XD * D - XH * H - XM * M )
seconds
Given 100 seconds, find: minutes, hours, days. Decision:
1min = 60 sec => 100 sec = 100/60 1 hour = 60 min = 60*60 sec => 100/60/60 1 day = 24 hour = 24*60 min = 24*60*60 sec = 100/24/60/60
not?
Source: https://ru.stackoverflow.com/questions/163313/