How can I calculate the number of days between two date fields?

How can I calculate the number of days between two date fields?

To calculate the number of days between two given date fields, for instance, ServiceStartDate and ServiceEndDate, add a formula field to the form with formula expression as below.


((ServiceEndDate - ServiceStartDate) / (1000 * 60 * 60 * 24))

,where ServiceStartDate & ServiceEndDate is the respective date fields.