Page 1 of 1

Days till birthday

PostPosted: Wed Jan 26, 2011 5:13 am
by MiltonTrickey
Hi Evertone

What calculation could I use to find how many days to a persons birthday using the feild DOB, making sure that it alters as each new day happens.

Thanks again

Milton.

Re: Days till birthday

PostPosted: Thu Jan 27, 2011 10:42 pm
by MiltonTrickey
Hi All,

I have tried using the following which works succesfully, but I would like it to change dynamically when the date changes, so that when a user checks the staff members page it will give an updated days till their birthday

TIA

Milton



/* ----------------------------------------------------------
Returns the number of days to the next birthday

Return type: Number
Syntax: NextBirthday ( birthdate )

DaysToNextBirthday ( birthdate ) returns 300
when birthdate contains April 12, 1957 and
today is June 16 2005.

Theo Ros
----------------------------------------------------------*/
Let ( now = Get ( CurrentDate ) ;
Case ( Date ( Month ( DOB ) ; Day ( DOB ) ; Year( now ) ) <= now ;
Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( now ) + 1 ) - now ;
Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( now ) ) - now )
)

Re: Days till birthday

PostPosted: Fri Jan 28, 2011 3:35 pm
by John Sindelar
Make that calc unstored and you should have what you need: it will reevaluate every time it needs to, though you sometimes need to open and close FileMaker in order for it to see that it is now "tomorrow".