Jump to content
Server Maintenance This Week. ×

Calculating elapsed time as decimal


This topic is 3196 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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! :)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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
)

 

Link to comment
Share on other sites

This topic is 3196 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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