How to determine if birthday or anniversary occured during date range
- by davekaro
Given I have a birthday/anniversary DateTime, how can I determine if that date occurred during a specific date range? For example,
Birthday = 1/2/2000
Date Range = 12/25/2008 - 1/3/2009
I need a method to determine whether or not this person's birthday happened during that date range - preferably in C#.
I first went about changing the year of the birthday DateTime to match the date range, then just check if the "new" birthday DateTime is between the start and end date of the date range... but when the date range spans different years, like in my example above - I had to add a nasty if statement. Is there no better way?