Here is a small piece of code in c# that does the trick:
public bool IsBirthdayBetweenDates(DateTime birthdate, DateTime beginDate, DateTime endDate)
{
if (birthdate != null & beginDate != null && endDate != null)
{
DateTime temp = birthdate.AddYears(beginDate.Year - birthdate.Year);
if (temp < beginDate)
{
temp = temp.AddYears(1);
}
return birthdate <= endDate && temp >= beginDate && temp <= endDate;
}
return false;
}Here beginDate is the start date for searchendDate: end date for search
The logic is simple,Just bring the birthdate to the year of begindate by adding years and then compare the dates.