# Discussions

View Only

## how to I set up the following duration formula?

• #### 1.  how to I set up the following duration formula?

Posted 06-19-2015 18:16

I am trying to calculate the number of volunteer hours from a start date and end date of an event.  How do I set up the formula?

• #### 2.  RE: how to I set up the following duration formula?

Top
Contributor
Posted 06-19-2015 20:09
Can you give some example situations and calculations?

• #### 3.  RE: how to I set up the following duration formula?

Posted 06-19-2015 20:17
If event A starts at 8am and ends at 1pm the volunteer hours for that event will be 5 hours.  How do I get it to do the calculation to get the 5 hrs?

• #### 4.  RE: how to I set up the following duration formula?

Top
Contributor
Posted 06-19-2015 20:35
I suggest that you have two time of day fields types for input.

Then ToHours([end time]-[start time])

You may also want to do
if(not IsNull([end time]) and not IsNull([Start Time]),ToHours([end time]-[start time]),0)

• #### 5.  RE: how to I set up the following duration formula?

Posted 07-17-2019 14:22
How do you handle this situation if the [date created] is Date/Time and the [Date Finished] is just a date? I don't think I can change the Date Finished type at this point without messing up a lot of data. I just need the amount of days from start to finish.

• #### 6.  RE: how to I set up the following duration formula?

Top
Contributor
Posted 07-17-2019 14:48
np, convert the date/time to be a just date for the purposes of the formula

[Date Finished] - ToDate([Date Created])

The above would be a duration or

ToDays([Date Finished] - ToDate([Date Created])) would be the number of Days ie a numeric result.