Calculate number of days between 2 dates

Hello Everybody,

I am looking for a solution : how i can calculate the number of days between two dates.

Already thank you for your support

Kind regards

Try this:

int(decimal-date-time(${date1}) - decimal-date-time(${date2}))

See decimal-date-time() and int() for details.

3 Likes

Great thank you.!

1 Like

I need this for two dates in Kobo, any easier way to make me understand how to have it on xls?

this is the error I am getting

Error: There has been a problem trying to replace ${date} with the XPath to the survey element named ‘date’. There is no survey element with this name.

@luswetiopicho, you could have a look at the sample shared below, the exact copy of what @Xiphware has outlined above:

In the survey tab of your XLSForm:

Data entry screen as seen in Enketo:

Reference XLSForm:

Calculate Days.xlsx (10.3 KB)

Thanks so much once again for coming through for me in this once again. it worked so well.

1 Like