If the dates are created when online you might store the unix time variant of the dates in separate fields and then substract and divide to calculate the number of days. If however the dates are being entered in offline mode and you need the difference in days you have quite a task ahead of you. With string manipulations (tostring and substring functions) you can find the month, day and year for the dates. You can transform the integer data into sort of a unix time in days by first determining the amount of days since the start of the year, Then determin the amount of days between the start of the year and 1-1-1970, to accomodate for multiple years (but not before 1970!) and then substract the 2 integer to find the days between the 2 dates. If the dates are in the same year only calculate back to the beginning of the year.
Quite a task as said as you'll need to take into account the leapyears as well, see below for the logic to determine the leapyear:
We've had a similar problem and actually build a custom widget to do the computation.
The widget would write the result in a temporary attribute and then you can use it in follow-up actions.
FillCurrentDateTimeString Widget (GitHub)