Function to calculate the difference between two dates using VB.NET

Tutorials PanelPosted by

The function below is to calculate the difference between two days. The result will be in days, and it can be zero if the two days are the same.

VB.NET

    Function calculateDiffDates(ByVal StartDate As DateTime, ByVal EndDate As DateTime) As Integer
        Dim diff As Integer
        diff = (EndDate - StartDate).TotalDays
        Return diff
    End Function

 

difference between 2 dates vb.net

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *