I have two DateTime objects in C#, say birthDateTime and curDateTime.
Now, I want to calculate the year difference bewteen current datetime and someone’s birthday. I want to do something like
int years = curDateTime- birthDateTime;
//If years difference is greater than 5 years, do something.
if(years > 5)
....
Sounds like you are trying to calculate a person’s age in the way people usually respond when asked for their age.
See Calculate age in C# for the solution.