Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi.
I am working with showing a list of upcoming birthdays. I have fields with the the date of birth that i can use to do this. I am able to calculate the age using the age() function. I also want to calculate how many days it is until each persons birthday, but I am unable to figure out how to do this.
Hi Dagrun,
Try this:
=If(MakeDate(Year(Today()),Month(dateOfBirth),Day(dateOfBirth))>=Today(),MakeDate(Year(Today()),Month(dateOfBirth),Day(dateOfBirth))-Today(),MakeDate(Year(addyears(Today(),1)),Month(dateOfBirth),Day(dateOfBirth))-Today())
Hope it works.
If not, just check for the "dateOfBirth" format.
Thanks
Sabal
Hi Dagrun,
You can use Date of Birth(field) - today() to get the number of days until each persons birthday.
Thanks
Sabal
Hi Sabal,
Try this,
Date(Today(),'MM-DD-YYYY') - Date(Date_of_Birth,'MM-DD-YYYY') as NoOfDays
Hope this will work for you.
-- Regards,
Vishal Waghole
When I did that I got some strange output.
What I found almost worked was using:
DayNumberOfYear(date(dateOfBirth)) - DayNumberOfYear(date(today))
This does give me the number of days until the birthday in the current year, but if the birthday has already happened this year I want it to calculate the number of days until the birthday in the next year. Other ways I will get strange output for the number of days till the closest birthday in the end of December
Oh and I guess there will also be a problem if the person was born in a leap year, but the current one is not a leap year.
if(Date(DateOfBirth)<Today(), num(Addmonths(Date(DateOfBirth),12)) - num(Today()),
num(Date(DateOfBirth)) - num(Today())) as NoOfDays,
Hi Dagrun,
Try this:
=If(MakeDate(Year(Today()),Month(dateOfBirth),Day(dateOfBirth))>=Today(),MakeDate(Year(Today()),Month(dateOfBirth),Day(dateOfBirth))-Today(),MakeDate(Year(addyears(Today(),1)),Month(dateOfBirth),Day(dateOfBirth))-Today())
Hope it works.
If not, just check for the "dateOfBirth" format.
Thanks
Sabal
Hi there.
I would simply do the following:
LET vYear = right(Today(), 7);
TEMP:
LOAD *
left(DOB, 2) & '/' & mid(DOB, 4,2) & '/' & vYear as [DOB Calculation]
FROM xxx.qvd;
DATA:
NOCONCATENATE
LOAD *,
[DOB Calculation] - Today() as [Days to go]
RESIDENT TEMP;
DROP TABLE TEMP;
Regards,
Marius
This worked. thank you