# Compute duration in days

From the example in Date and Time Expressions : Examples that compute duration in days, months and years

FLOOR(((HOUR([EndDate] - [StartDate])) - (([Years] * 365.24 * 24.0) + ([Months] * 30.4 * 24.0))) / 24.0)

Question :
What is the difference from :
FLOOR(HOUR([EndDate] - [StartDate])/24)
since i got the same result.

It seems the expression example from the doc simply returns the difference between the day number.

May 25 2021 and May 20 2021, returns 5 (25-20).
May 25 2021 and April 20 2021, also returns 5 (25-20).
May 25 2021 and April 20 1999, also returns 5 (25-20).

Why would you ever need this expression? I’m not sure.

I need to compute the number of days between the startdate and the enddate. (how many days between two dates input in apps aka the duration of using a spare part)

At first, I was wrongly using an expression : DAY([EndDate]) - DAY([StartDate]) , returns the difference between the day number. So I searched from the doc, found the expression example there.

Honestly, I didn’t try the long expression from the doc. Confused with the [Years] and [Months] as said to be Virtual Columns there. I try : FLOOR(HOUR([EndDate] - [StartDate])/24) , the outcome is exactly what I’m looking for. So I wondered is there anything that I should know about that long expression.

Thanks @Marc_Dillon