4 Replies Latest reply on Jan 23, 2015 5:24 AM by jaffadave

# Time converted to fraction

Hi All,

i'm very new to FileMaker so this maybe a really basic question.

I have a timesheet with StartingDate, TimeStarted,TimeFinished & a calculation field named ElapsedTime to calculate hours worked using
Mod (TimeFinished- TimeStarted+ 86400; 86400)

I then have another Field called ConvertToFraction set as a calculation
Hour(ElapsedTime) & Minute(ElapsedTime) / 60
this converts the time worked into a fraction so 7 hour 30 minutes will show 7.5 - so far so good

The field is set to a number with 2 decimals.

My problem is if a employee enters say 7:00am to 3:00pm the calculation comes out as 80 rather than 8.

How do i fix this.

• ###### 1. Re: Time converted to fraction

I'm not sure about your formula for elapsed time. If the time fields are Time fields and on the same date, I use (EndTime-StartTime)/3600 to convert to hours and fraction of hours. The second ConvertToFraction is not needed.

If the time will run across several days, then I would use a custom function. A good source for these is http://briandunning.com.

HTH,

Michele

• ###### 2. Re: Time converted to fraction

Try

( TimeFinished - TimeStarted ) / 3600 to get a decimal result.

By the same token, you can simplify the first calculation (complete hours worked) as

Div ( TimeFinished - TimeStarted ; 3600 )

btw: Mod (TimeFinished- TimeStarted+ 86400; 86400) is equal to TimeFinished - TimeStarted

1 of 1 people found this helpful
• ###### 3. Re: Time converted to fraction

Michele Olson wrote:

If the time will run across several days, then I would use a custom function

There's not really a need for a CF; apply the same logic using timestamps, rather than times.

• ###### 4. Re: Time converted to fraction

Thanks so much, that's an easier way of doing it, looks like i was over thinking things. Appreciate your help