1 Reply Latest reply on May 27, 2013 11:26 AM by GuyStevens

# Calculation......Aaagh

### Title

Calculation......Aaagh

### Post

Hello,

I'm wondering two things, if a calculation is possible to give an answer I'm looking for (which I'll explain in one minute) and how do I even go about a calucation like that if so.

Basically in a portal I have the following field:

Entry Date, Entry Time, Exit Date, Exit Time

Hours are broken down the following way:

Hourly = 8am-8pm ; Overnight = 8pm - 8am

Basically what I need to do is if fields are entered as:

Entry Date: 05/26/13  Entry Time:  8:00am  Exit Date 05/27/13  Exit Time:  8:00 am

I need the calculated field to say: 1 Overnight, 12 Hours

But if the fields are:

Entry Date: 5/27/13  Entry Time:  8:00 am  Exit Date  05/27/13  Exit Time  11:00 pm

Calculation field to say:  15 Hours

Is this possible? Haven't a clue how to even begin.

• ###### 1. Re: Calculation......Aaagh

You have date and time fields, so those can be turned into timestamp fields to calculate the difference.

The "out" timestamp minus the "In" timestamp should give you the time worked.

If you use the function "Hour" in there you can get the amount of hours.

Then if the Date in is not the same as the Date out you have an overnight. You could make a separate calculation for that.
If you keep this in a separate field you can later on perform a find on overnights.

Then you can combine those. into a longer text.

A little like this example:

https://dl.dropboxusercontent.com/u/18099008/Demo_Files_FMP12/TimeTest.fmp12