Public Function YearsBetweenDates(ByVal StartDate As DateTime, _
ByVal EndDate As DateTime) As Integer
' Returns the number of years between the passed dates
If Month(EndDate) < Month(StartDate) Or _
(Month(EndDate) = Month(StartDate) And _
(EndDate.Day) < (StartDate.Day)) Then
Return Year(EndDate) - Year(StartDate) - 1
Else
Return Year(EndDate) - Year(StartDate)
End If
End Function
Please SUBSCRIBE to get new articles directly into your Email inbox!
ByVal EndDate As DateTime) As Integer
' Returns the number of years between the passed dates
If Month(EndDate) < Month(StartDate) Or _
(Month(EndDate) = Month(StartDate) And _
(EndDate.Day) < (StartDate.Day)) Then
Return Year(EndDate) - Year(StartDate) - 1
Else
Return Year(EndDate) - Year(StartDate)
End If
End Function
Please SUBSCRIBE to get new articles directly into your Email inbox!
تعليقات
إرسال تعليق