Time and timestamp arithmetic
IntermediatePerform accurate calculations with Time and Timestamp fields, including duration, elapsed time, and cross-midnight handling.
What you'll learn
- How FileMaker stores Time and Timestamp values internally
- How to calculate elapsed time and express it in hours/minutes/seconds
- How to handle time arithmetic that crosses midnight
- How to add or subtract a duration to a Timestamp
FileMaker stores Time values as the number of seconds since midnight, and Timestamps as the number of seconds since January 1, year 1, at midnight. This means arithmetic works on both: subtract two Timestamps to get elapsed seconds, add seconds to a Timestamp to advance it. Knowing the underlying units is essential for converting durations to hours, minutes, and seconds.
Stuck is a valid status
Need a second brain on this one?
If this lesson just collided with your real schema, script stack, or deadline, book consulting and turn the confusion into a concrete plan.
Time arithmetic basics
Time fields store seconds since midnight. Subtracting two Time values gives elapsed seconds. Use Div() and Mod() to break it into hours, minutes, and seconds.
Let ( [ elapsed = EndTime - StartTime ; // result in seconds h = Div ( elapsed ; 3600 ) ; m = Mod ( Div ( elapsed ; 60 ) ; 60 ) ; s = Mod ( elapsed ; 60 ) ] ; h & "h " & m & "m " & s & "s" ) // e.g., "2h 15m 30s"
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo