Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. public int CalculateAge(DateTime birthDate, DateTime now)
  2. {
  3. int age = now.Year - birthDate.Year;
  4.  
  5. if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day))
  6. age--;
  7.  
  8. return age;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement