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

Calculation of Total Time Between Two Times


Recommended Posts



I'm trying to calculate the difference between a start and end time, where the start time starts at 23:30 (11:30 PM) on one day, and ends on the following day at ,say, 02:30 (2:00 AM). I currently record the start date, the start time, and the end time. The calculation I'm using now always returns the answer as 4 hours, regardless of the actual difference:


Hour ( If ( Start Time > End Time ; ( Start Time - End Time ) / 5 ; End Time - Start Time ))


Any help would be appreciated.

Link to comment
Share on other sites

First off, stop trying to use time field by themselves in conjunction with IF statements. That's how we had to do it in the era before FileMaker 7, but we have timestamp fields now :)


Start recording the end DATE as well as the end TIME.



Elapsed Time = TimeStamp (EndDate; EndTime) - TimeStamp (StartDate; StartTime) will yield the difference in seconds. Divide by 60 to get time difference in minutes, divide that by 60 to get time diff in hours; use Truncate and Mod to get whole hours and remaining minutes and/or take the remaining minutes and get whole minutes and remaining seconds as well.


Well, OK, since you aren't already doing it that way...


Set Variable [$EndDate; Case (Start Time > EndTime; StartDate+1; StartDate) NOTE: you'll get wrong answers if your end time on the following date is later than the start time was, in other words if it goes beyond 24 hours; but without you recording end date it's the best we can do





Elapsed Time = TimeStamp ($EndDate; EndTime) - TimeStamp (StartDate; StartTime)



where EndTime, StartDate, and StartTime are fields and $EndDate is a variable calculated as per the equation above.

Link to comment
Share on other sites

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