コード例 #1
0
    public static int GetAge(this MAgeProvider map)
    {
        DateTime dtNow  = DateTime.UtcNow;
        DateTime dtBorn = table.GetOrCreateValue(map).BirthDate;
        int      age    = ((dtNow.Year - dtBorn.Year) * 372
                           + (dtNow.Month - dtBorn.Month) * 31
                           + (dtNow.Day - dtBorn.Day)) / 372;

        return(age);
    }
コード例 #2
0
 public static void SetBirthDate(this MAgeProvider mAgeProvider, DateTime birthDate)
 {
     table.GetOrCreateValue(mAgeProvider).BirthDate = birthDate;
 }