4 Replies Latest reply on Feb 25, 2013 5:20 AM by CraigFiore

# Converting Time To a Number

### Title

Converting Time To a Number

### Post

Hello,

I am building a time card and I would like to convert the total time worked is not working out so good for me. Here is what I have so far.

My calculation is:

Time End-Time Start - Lunch*60= Total time worked
All Fields are "Time" fields except for "Total Time Worked" I switched it back an fourth.

5:30pm -8:00am-:30 = 60300.00 (if Total time worked is a Number)
5:30pm -8:00am-:30 = 8:45:00 (if Total time worked is Time)

I would like it to read 8.75

What would be the best way to do this?

Thank you.

Craig

• ###### 1. Re: Converting Time To a Number

Time fields store time in seconds so the difference of two time fields computes the elapsed time in seconds.

What kind of values are being recorded in Lunch? multiplying it by 60 does not make sense here. If Lunch = 1 when the person takes a 1 hour lunch, this is the calculation that will return a decimal value in hours:

( Time End-Time Start  ) / 3600 - Lunch

Select Number as the return type.

• ###### 2. Re: Converting Time To a Number

Hi Phil,

I am recording lunch as minutes, ie :30, :45, :60 etc.

I got the orginal calculation from you back in October, http://forums.filemaker.com/posts/184c0596dd

Ok now I changed the Lunch to Number, ie .5, .75, 1, so my total works out to a normal number ie 8.5.

Is it possibe to make the the lunch field read as time, ie :30, :45, :60, or some varations of that? I tried different options and caculations but could not get it to work.

Thank you

• ###### 3. Re: Converting Time To a Number

You can enter lunch in as 30 , 45 ,60  (number) format as currency and change currency symbol to :, this will make your field read :30, :45, :60 and then use the following calculation.

(endtime - starttime) /3600 - (Lunch/60)

• ###### 4. Re: Converting Time To a Number

Thanks to the both of you. It works great!!

Craig