"JoskeXP" <an*******@discussions.microsoft.com> schrieb
I need this because I have to now of he's at least 21 year's old.
When I do 1/1/2004 - 31/12/2003 I get 1 Year but it's only 1 day
difference. When he's 20 Year 11 Months and 25 day's I only need 20
Year and noy 21 Year
Public Function GetAge( _
ByVal BirthDate As Date, ByVal ReferenceDate As Date) As Integer
GetAge = ReferenceDate.Year - BirthDate.Year
If ReferenceDate.Month < BirthDate.Month _
OrElse (ReferenceDate.Month = BirthDate.Month _
AndAlso ReferenceDate.Day < BirthDate.Day) Then
GetAge -= 1
End If
End Function
--
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html