+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Birthday: Expression for Calculating the Age

(combit Team) #1
Valid from Report Server 1
Following expression calculates the age from a BIRTHDAY variable (of L&L type 'date'):
Cstr$(Year(Today()) - Year(BIRTHDAY) - if(DateToJulian(DateYMD(1, Month(Today()), Day(Today()))) - DateToJulian(DateYMD(1, Month(BIRTHDAY), Day(BIRTHDAY))) < 0,1,0), "%25.0f")

You can use this expression in reports to print persons’ ages when just knowing their birthday.

This expression considers automatically whether the birthday already has happened this year or not. This may not be useful when being used for “Happy Birthday” cards, because there you’ll need the “new” age, not the current. For this purpose use the following expression:

Cstr$(Year(Today()) - Year(BIRTHDAY), "%25.0f")
IDKBAE001289 KBAE001289