I am using these three calculations to get age in days, years, and months (
the reason is i need to know for very young children how many months old
they are so that you can prescribe malaria meds)
daysOld (now().getTime()-new Date(data('bday')).getTime())/1000/60/60/24
monthsOld data('daysOld') % 30 yearsOld data('daysOld') % 365
So, The days figure up correctly, but the months and years show up all
crazy wrong.
In the survey, these calculates look at the date selected for the birthday,
and then assign values to variables.
assign integer daysOld calculates.daysOld()
assign integer monthsOld calculates.monthsOld()
assign integer age calculates.yearsOld()
And then I read them back out in a note, just to check them:
Confirm birthday is {{data.bday}} confirm daysOld is {{data.daysOld}} and
confirm monthsOld is {{data.monthsOld}} and confirm age is {{data.age}}
But it comes out like this:
What thinkest thou?