I am working on a project which starts time and ends time in 24-hour (my SQL) format 16:24:00.
My variables are $stime1 = '13:00:00' and $etime1 = '15:24:00'
I managed to properly add an hour if needed so it calculates total hours spend on project.
But now I need to do it every 30 minutes, so I need to round it off to 1 hour or 1,5 hours, or 2 hours, or 2,5 hours
Can someone tell me if there is a better way of doing this than using array and making so many if statments?
I want to be able to calculate if its from 1~14 minutes to leave at that hour, if 15~44 make it 0,5 of an hour and from 45~59 go onto the 1,0 hour.
Thanks for your help...
if ($stime1[3] => 3) {
$nstime1 = $stime1+1;
} else {
$nstime1 = $stime1;
}
if ($etime1[3] => 3) {
$netime1 = $etime1+1;
} else {
$netime1 = $etime1;
}
$ttime1 = ($netime1 - $nstime1);