4 Replies Latest reply on Jan 20, 2010 3:41 PM by penhaifai

# two Dates deference and the outcome should b a specific text sentence!!

### Title

two Dates deference and the outcome should b a specific text sentence!!

### Post

I have two Date type fields. One for the record creation date and the other; let's say; for DOB; date of birth; and I have this criteria to come up with;

0-6 Months
7-12 Months
1-2 years
3-4 years
5-6 years
7-8 years
9+  years

How can I calculated the date deference and then pick the relevant criteria? It should b shown in a field.

• ###### 1. Re: two Dates deference and the outcome should b a specific text sentence!!

Howdy penhaifai,

If your result field is set up as a calculation, result as text, and your calculation is of the form:

Case ( RecordCreationDate - DOB < 182 ; "0-6 months" ;

RecordCreationDate - DOB < 365 ; "7-12 months" ;

RecordCreationDate - DOB < 1095  ; "1-2 years" ;

RecordCreationDate - DOB < 1825  ; "3-4 years" ;

RecordCreationDate - DOB < 2555  ; "5-6 years" ;

RecordCreationDate - DOB < 3285  ; "7-8 years" ;

"9+ years"  )

it should get you very close.  The remaining question would be, "How accurate to 6 months, 2 years, etc. do you want to be?"

The needed level of accuracy can affect the complexity of the calculation expression.

• ###### 2. Re: two Dates deference and the outcome should b a specific text sentence!!

It works like a magic!! =) thank you so much!!

it doesn't matter regarding the accuracy if it's like only days since we are dealing with months and years ;-)

• ###### 3. Re: two Dates deference and the outcome should b a specific text sentence!!

penhaifai wrote:

it doesn't matter regarding the accuracy if it's like only days since we are dealing with months and years ;-)

Yes but what you interpret as a definition of a month may be different than what others do. For example, is a month 30 days, 31 days, the same numeric day but with an incrementing month number such as Jan 15 and Feb 15? Do you see the point?

• ###### 4. Re: two Dates deference and the outcome should b a specific text sentence!!
You are absolutly right; mr_vodka; what it's not important for me might be important for others; and even for me at some point in the future.

Thank you for clearing up this point :smileyhappy: