Service Desk Practitioners Forum
cancel

Highlighted
Contributor.

## How to subtract two fields of type Duration

I want to subtract two fields, both of type Duration. Is it possible in HPSD 4.5,sp22? if not,
what can be done as an alternate solution to this?
3 REPLIES
Acclaimed Contributor.

## Re: How to subtract two fields of type Duration

Well, you can do it. You must use three date fields.

Suppose that you want to subtract duration1 from duration2

Create a rule that does the following

add duration2 to a custom date field (date1) and store the value to (date2)
add duration1 to date1 and store to date3
set duration = subtract date2 from date3

what you did is this
date2=date1+duration1
date3=date1+duration2

duration=date3-date2=duration2-duration1
menes fhtagn
Contributor.

## Re: How to subtract two fields of type Duration

thankx for you so quick response
actually, i am trying to get the time diffrence as follows:
1>Actual Time(Type:Duration)= Actual Finish(Type:Date)- Actual Start(Type:Date)

2>Pending Time(Type:Duration)= Pending Start(Type:Date)- Pending End(Type:Date)

3>Resolve Time(Type:Duration)= Actual Time-Pending Time

Now there is no function available to find this difference,
what should i do?
Super Contributor.

## Re: How to subtract two fields of type Duration

Another possible solution is to create 2 numeric fields and assign duration 1 and 2, then substract them and store result again in duration field - at least with date fields it was possible to convert them to numeric values and manipulate as you like with them