Niek Knijnenburg

duration.months remains 0

Discussion created by Niek Knijnenburg on Jul 10, 2012
Latest reply on Jul 11, 2012 by Niek Knijnenburg

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?