Public Function GetKinzoku(ByVal dtEntire As Date, ByVal dtRetire As Date) As TypeKinzoku
Dim iDay As Integer
iDay = DateTime.Day(dtRetire) - DateTime.Day(dtEntire)
Dim iMonth As Integer
iMonth = DateTime.Month(dtRetire) - DateTime.Month(dtEntire)
Dim iYear As Integer
iYear = DateTime.Year(dtRetire) - DateTime.Year(dtEntire)
If iDay < -1 Then
iMonth = iMonth - 1
End If
If iMonth < 0 Then
iYear = iYear - 1
iMonth = iMonth + 12
End If
If iYear < 0 Then
iYear = 0
iMonth = 0
End If
Dim tKinzoku As TypeKinzoku
tKinzoku.Year = iYear
tKinzoku.Month = iMonth
Let GetKinzoku = tKinzoku
End Function
|