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; Quote Link to comment Share on other sites More sharing options...
coupe-r Posted September 28, 2010 Share Posted September 28, 2010 if($tbilled < 0) { $tbilled = $tbilled + 24; } ????? Quote Link to comment 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; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.