flemingmike Posted September 28, 2010 Share Posted September 28, 2010 hello, i have a start time and an end time (no dates). the following works great, except for when the start time is at night, and the end time is in the morning. im thinking if i can do an if the number is negative, add 24, that it will resolve my issue. any ideas? $tbilled = $tfinish - $tstart; Link to comment https://forums.phpfreaks.com/topic/214593-if-number-is-a-negative-number-add-24/ Share on other sites More sharing options...
coupe-r Posted September 28, 2010 Share Posted September 28, 2010 if($tbilled < 0) { $tbilled = $tbilled + 24; } ????? Link to comment https://forums.phpfreaks.com/topic/214593-if-number-is-a-negative-number-add-24/#findComment-1116642 Share on other sites More sharing options...
flemingmike Posted September 28, 2010 Author Share Posted September 28, 2010 perfect. one other thing i just noticed. when it does the subtraction, it is only subtracting the hour, not the minutes. here is what i have, any ideas? the format for my time is 00:00:00 $tbilled = $tfinish - $tstart - $tlunch; if($tbilled < 0) { $tbilled1 = $tbilled + 24; } else { $tbilled1=$tbilled; } Link to comment https://forums.phpfreaks.com/topic/214593-if-number-is-a-negative-number-add-24/#findComment-1116643 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.