I am trying to find someones age within 2 months of their birthday on the
given date for the run of the application
Dim d_runOn As DateTime = #4/4/2005#
Dim d_bday As DateTime = #6/26/1986#
Console.WriteLine(String.Format("Ran on {0}, birthdate {1}",
d_runOn.ToShortDateString, d_bday.ToShortDateString))
Console.WriteLine(String.Format("Years difference: {0}",
DateDiff(DateInterval.Year, d_bday, d_runOn.AddMonths(2),
FirstDayOfWeek.System, FirstWeekOfYear.System)))
Console.WriteLine(String.Format("Age of date: {0}",
Math.Floor((DateDiff(DateInterval.Day, d_bday, d_runOn.AddMonths(2),
FirstDayOfWeek.System, FirstWeekOfYear.System) / 365))))
of course the DateInteral.Year rounds so even though the person has no
turned 19 yet, it says they are 19. I need it to say they are still 18 years
old (the second one with the Math.Floor / 365 one) gives the correct age
(18). How would i prevent rounding of the DateInterval.Year one?! or is it
even possible?