07-10-2012 07:33 AM
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?
Solved! Go to Solution.