Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Time calc past midnite


Recommended Posts

I just know that Chopper will have the answer to this one! laugh.gif


I have a database where I record a total amount of time spent based on a calculation of "end time minus start time". Times are entered based on a 12 hour clock with AM and PM notations. My problem is when one lists say 8:00 PM to 12:00 AM the calc returns a negative number. I know it's doing this because it assumes the times are both from the same day.


How can I account for times spilling over to the next day and keep my calculations correct?


Link to comment
Share on other sites

Or you can add a calc field called


Elasped Time = ((End Date - Start Date) * 86400) + End Time - Start Time



You will have to set your times and dates with a Start Time script and a Stop Time script

Link to comment
Share on other sites


That's the same logic as mine except that I have abstracted the repetition of the "endTime - startTime" part of the calculation:


Yours = If( test, A + 86400, A )

Mine = A + If( test, 86400, 0 )


where A = endTime - startTime


It would be a very minor speed improvement wink.gif but the logic is worth noting for larger nested calculations.

Link to comment
Share on other sites

  • 4 weeks later...
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Terms of Use