This commit is contained in:
2021-08-30 21:49:56 +08:00
parent 969c81925b
commit 8ce6070be5
110 changed files with 967 additions and 106 deletions
+15
View File
@@ -590,5 +590,20 @@ namespace BLL
}
}
#endregion
/// <summary>
/// 获取年龄
/// </summary>
/// <param name="birthDate"></param>
/// <param name="now"></param>
/// <returns></returns>
public static int CalculateAgeCorrect(DateTime birthDate)
{
DateTime now = DateTime.Now;
int age = now.Year - birthDate.Year;
if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day)) age--;
return age;
}
}
}