Calculate The Elapsed Time Between Two Dates

'Insert the following code to your form (Form1):

Private Sub Form_Load()
'Replace the dates below with the dates you want to calculate the time elapsed
'between them. If you want that one of those dates will be the current date, Place 'Date'
'instead of one them.

mytotaldays = DateDiff("d", "20/12/80", "4/6/83")
Myyears = Int(mytotaldays / 365)
mydays = mytotaldays - Myyears * 365
MsgBox "The Time elapsed between the two dates is " & _
mytotaldays & " Days, Which are " & Myyears & " Years, And " _
& mydays & " Days"
End Sub

Go Back