Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calculating elapsed time as decimal

Featured Replies

Hi all

Trying to create a more automated way of creating my invoices and I'm running into the issue of calculating elapsed time when it passes midnight. My time is entered as a decimal (i.e. 1:30pm would be 13.50). I'm running into issues when the wrap time (or out time) is past midnight. If the hours entered are between 12am and 12am I'm not having an issue, but as I sometimes work past midnight I need FM to be able to recognise I'm in a new day when I clock out. FileMaker takes the "hours worked" and calculates my daily pay by the hourly rate assigned for that particular job. 

The "hours worked" is calculated from "call" (in time), meal 1 out, meal 1 in, meal 2 out, meal 2 in and wrap. Currently I'm only entering the date of the day worked. Will using this decimal format require the entry of a start date AND end date or can this be avoided? Decimal time is required by my employers, and this could be easily remedied by continuing to count past hour 24 (1am would be 25.0, for example) but I would like to avoid this if possible. 

Im sure this is a simple calculation but I have confused myself in the process as these aren't time fields, but rather numbers.

Help much appreciated! :)

Assuming you never work for more than 24 hours, you can calculate the duration as =

EndTime - StartTime + 24 * ( EndTime < StartTime )

 

  • Author

Thanks, comment. I'm not at my computer to test at the moment, but to factor in breaks I've created a calc to determine each break duration, so might the following work (also considering a break might overlap or take place after midnight)?

end time - start time + break 1 - break 2 + 24 * (end time < start time)

end time - start time + break 1 - break 2 + 24 * (end time < start time)

You probably meant:

end time - start time - break 1 - break 2 + 24 * (end time < start time)

which should work, if break 1 and  break 2 are already durations. Why don't you do it all at once, e.g.

Let ( [
duration = EndTime - StartTime + 24 * ( EndTime < StartTime ) ;
break1 = Break1End - Break1Start + 24 * ( Break1End < Break1Start ) ; 
break2 = Break2End - Break2Start + 24 * ( Break2End < Break2Start ) 
] ;
duration - break1 - break2
)

 

  • Author

That'll do it! You rock

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.