Download Blaze Trial
Follow FICO
LinkedIn   Twitter   Youtube
Close To access this section, please choose the Community Neighborhood in which you have the most interest.

» Business Rules Management
» Collections & Recovery
» Fraud Management
» Risk Management
» Scoring
Close To access this section, please choose the Community Neighborhood in which you have the most interest.

» Business Rules Management
» Collections & Recovery
» Fraud Management
» Risk Management
» Scoring
Reply
Contributor
Posts: 21
Registered: ‎11-16-2009
Accepted Solution

duration.months remains 0

I am trying to calculate a person's age in years.

Duration has no years, only months but that stays 0?!?

 

See following code:

bd is a date;
age is a duration;
bd = '10-June-2012';
age = calendar().currentDate().subtractInDays(bd);
print("d: " age);
print("age in days: " age.days);
print("age in months: " age.months);

 

What am I doing wrong?

Contributor
Posts: 21
Registered: ‎11-16-2009

Re: duration.months remains 0

found it, am now using substractInMonths

and taking floor(age.months / 12)