Previous Entry Share Next Entry
Получаем возраст по дате рождения
Панда WTF !?
ect0plasm wrote in dotnetcookbook
 

public static int BirthdayDateToAge(DateTime birthdayDate)

{

int age = DateTime.Now.Year - birthdayDate.Year;

DateTime someDate = DateTime.Now.AddYears(-age);

      if (someDate < birthdayDate)

      {

            age--;

      }

 

return age;

}


?

Log in