Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Birthdate - Actual day this year

Status
Not open for further replies.

psamedy

Technical User
Apr 22, 2002
60
US
I have a birth date field, that I need displayed with that actual date, and the present day that the birthdate falls on. How do i accomplish this.


Thanks Pat
 
The only thing you need to really check for is leap years and Feb 29th birthdays, so try this:

//check for current year is leap and birthday is 2/29
if remainder(Year(CurrentDate),4)=0 and
Month({BirthdayField})=2 and
Day{BirthdayField})=29 then
Date(Year(CurrentDate),Month(BirthdayField), day({BirthdayField}))

//current year = leap year and birthdays in a non-leap year
If Month({BirthdayField})=2 and Day{BirthdayField})=29 then Date(Year(CurrentDate),Month(BirthdayField), 28) else

//all other birthdays
Date(Year(CurrentDate),Month(BirthdayField), day({BirthdayField}))


Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
If you mean you want the day of the week for the birthday this year, then wrap dgillz's formula in:

weekdayname(dayofweek({@dgillz's formula}))

-LB
 
To correct dgillz coding a little (added some "(" and "{" and an "else"), if I may and add lbass':
Code:
WeekDayName(DayOfWeek(
//check for current year is leap and birthday is 2/29
if remainder(Year(CurrentDate),4)=0 and 
Month({BirthdayField})=2 and 
Day({BirthdayField})=29 then 
Date(Year(CurrentDate),Month({BirthdayField}), day({BirthdayField})) else

//current year = leap year  and birthdays in a non-leap year
If Month({BirthdayField})=2 and Day({BirthdayField})=29 then Date(Year(CurrentDate),Month({BirthdayField}), 28) else

//all other birthdays
Date(Year(CurrentDate),Month({BirthdayField}), day({BirthdayField}))
))

~Thadeus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top