Showing posts with label DateTime. Show all posts
Showing posts with label DateTime. Show all posts

Function To Get the Difference between 2 Dates in different Formats

Purpose : Function To Get the Difference between 2 Dates .
In the Form of : Day ,DayOfYear ,Hour,Minute,Month,Quarter Second,Weekday,Week Of Year,Year
Use : DateInterval.Day / DateInterval.DayOfYear ....

Code :
    Public Sub DateDifference()
        Dim DateDiffVal As Long
        DateDiffVal = DateDiff(DateInterval.Year, DateTimePicker1.Value, DateTimePicker2.Value)
        MsgBox("Date Difference Is : " & DateDiffVal, MsgBoxStyle.DefaultButton1, "Information")
    End Sub