How to get the difference in the number of days between two dates?

on the other hand, I am trying to get the difference in the number of days between two dates e.g. if someone logged in a question on 1/12/2021 and closed the issue on 8/12/2021 it automatically calculates and displays the number of days.

Hello @nuthaj2021,
The available date functions can be found here
https://getodk.github.io/xforms-spec/#fn:Date-and-Time-Functions.
Other hints on date variables can be found here
https://xlsform.org/en/.

Dear @Kal_Lam,
Seems (again) that there are a lot of questions around date calculations in the forum. So, having a support article with various examples might be helpful? For ex.

  • calculate age from birthday
  • working with incomplete birthday entries
  • constraining dates
  • extracting (or formatting) date elements
  • calculating date differences, incl. result in days
  • today metadata vs today() function
  • start and end (meta)
  • hide date (date with calculation, but neither label nor hint).

At the moment, the Help Center only offers few hints here:
https://support.kobotoolbox.org/advanced_calculate.html?highlight=date%20calculation#list-of-tested-calculate-functions

There is a days-from-date() function mentioned there, which I could not find elsewhere. Is this working?

Kind regards

1 Like

Thanks for sharing let me check it out.

Regards,

@luswetiopicho, could also be helpful:

Thanks so much this solved the issue!!

1 Like