Calculating age in months and days

Hi,

Im trying to calculate age in months and days in Commcare. The calculation
will be done as ‘current date - DOB’

I know you can do the calculation seperately as months, years, weeks or
days, but is there anyway to set a claculation and show the output as
months and days (e.g. 24 months, 15 days)?

Thanks in advance for any help!

Hi Sabeth,

There is an operator you can use in CommCare logic called “mod”. You can
use it to get the remainder of days after you divide to get the number of
months.

We have some documentation here that might be helpful: https://confluence.
dimagi.com/display/commcarepublic/CommCare+Functions#CommCareFunctions-mod

··· On Wed, Oct 12, 2016 at 4:01 AM, Sabeth Ahmed wrote:

Hi,

Im trying to calculate age in months and days in Commcare. The calculation
will be done as ‘current date - DOB’

I know you can do the calculation seperately as months, years, weeks or
days, but is there anyway to set a claculation and show the output as
months and days (e.g. 24 months, 15 days)?

Thanks in advance for any help!


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi Amelia,

Thank you very much for this! I will try it out

··· On Oct 12, 2016 9:59 PM, "Amelia Sagoff" wrote:

Hi Sabeth,

There is an operator you can use in CommCare logic called “mod”. You can
use it to get the remainder of days after you divide to get the number of
months.

We have some documentation here that might be helpful:
https://confluence.dimagi.com/display/commcarepublic/CommCare+Functions#
CommCareFunctions-mod

On Wed, Oct 12, 2016 at 4:01 AM, Sabeth Ahmed smunrat@gmail.com wrote:

Hi,

Im trying to calculate age in months and days in Commcare. The
calculation will be done as ‘current date - DOB’

I know you can do the calculation seperately as months, years, weeks or
days, but is there anyway to set a claculation and show the output as
months and days (e.g. 24 months, 15 days)?

Thanks in advance for any help!


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit https://groups.google.com/d/
topic/commcare-users/MKvy25c2u3o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.