AnsweredAssumed Answered

Calculating hours

Question asked by EdwardAlvarez on Feb 5, 2014
Latest reply on Feb 6, 2014 by EdwardAlvarez

Title

Calculating hours

Post

     Hi,

     I am trying to auto calculate the staff hours on our contracts. we currently have a drop down list where we pick the hours. i want to automate this and make a formula calculate it on its own. i have this formula that is working great; however, it only works until 11:59pm. once i enter 1am for example, the formula does not calculate the hours anymore. 

     In our business we usually go over 12am, we often work until 1am or 2am and start around 6pm-9pm. so if i have an event from 5pm-1am it should calculate 8 hours but it won't calculate the hours correctly it instead gives me a negative number (-15). if i enter 5pm-10pm for example it calculates correctly and it gives me 5 hours. what am i doing wrong?

     This is the formula i am currently using:

If(GetAsNumber(Valet Start Time:) <  GetAsNumber(Valet End Time:); Hour( Valet End Time: - Valet Start Time: ) + Minute( Valet End Time: - Valet Start Time:)/60; Hour( Valet End Time:+24 - Valet Start Time: ) + Minute( Valet End Time: - Valet Start Time: )/60)

     Thank you

     Edward

Screen_Shot_2014-02-05_at_4.06.13_PM.png

Outcomes