Calculating number of days

Hie…

Can Someone please tell me which function I use to calculate the number of
days that have elapsed since registering a patient for a supplementary
feeding programme.

will this work because i seem to hv errors?

(today() - date_of_discharge )+ 1

Eva

Hi Eva,

When you’re doing calculations with dates, you actually have to ‘cast’ the
arguments so they’re read as dates, instead of the funny-looking numbers CC
saves in the back end. I think that

date(today()) - date(date_of_discharge)

should give you what you want. Also check out some help here:
https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+Tutorial+Part+2%3A+Calculations+Using+a+Date

Good luck!

Best
Jordan

··· On Thu, Sep 21, 2017 at 9:20 AM, Eva wrote:

Hie…

Can Someone please tell me which function I use to calculate the number of
days that have elapsed since registering a patient for a supplementary
feeding programme.

will this work because i seem to hv errors?

(today() - date_of_discharge )+ 1

Eva


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.


Jordan Levinson
Dimagi India | Field Manager
D - 1/28 Vasant Vihar | New Delhi 110057, India
t: +91 11.46704670 | m: +91 9599692119
www.dimagi.com

- We’re hiring! Find out more here http://www.dimagi.com/about/careers/.
-

Thanks Jordan…let me try that out

··· On Thursday, September 21, 2017, Jordan Levinson wrote:

Hi Eva,

When you’re doing calculations with dates, you actually have to ‘cast’ the
arguments so they’re read as dates, instead of the funny-looking numbers CC
saves in the back end. I think that

date(today()) - date(date_of_discharge)

should give you what you want. Also check out some help here:
https://confluence.dimagi.com/display/commcarepublic/Hidden+Values+
Tutorial+Part+2%3A+Calculations+Using+a+Date

Good luck!

Best
Jordan

On Thu, Sep 21, 2017 at 9:20 AM, Eva <eva.tsitsi@gmail.com <javascript:_e(%7B%7D,‘cvml’,‘eva.tsitsi@gmail.com’);>> wrote:

Hie…

Can Someone please tell me which function I use to calculate the number
of days that have elapsed since registering a patient for a
supplementary feeding programme.

will this work because i seem to hv errors?

(today() - date_of_discharge )+ 1

Eva


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
<javascript:_e(%7B%7D,‘cvml’,‘commcare-users%2Bunsubscribe@googlegroups.com’);>
.
For more options, visit https://groups.google.com/d/optout.


Jordan Levinson
Dimagi India | Field Manager
D - 1/28 Vasant Vihar | New Delhi 110057, India
https://maps.google.com/?q=D+-+1/28+Vasant+Vihar+|+New+Delhi+110057,+India&entry=gmail&source=g
t: +91 11.46704670 | m: +91 9599692119
www.dimagi.com

- We’re hiring! Find out more here
http://www.dimagi.com/about/careers/. -


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/1Sok8WN8wbI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com
<javascript:_e(%7B%7D,‘cvml’,‘commcare-users%2Bunsubscribe@googlegroups.com’);>
.
For more options, visit https://groups.google.com/d/optout.