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


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

Tutorials Panel

About Tutorials Panel

programming tutorial and source code for Software Engineers and developers. https://twitter.com/TutorialsPanel

View all posts by Tutorials Panel →

One Comment on “Function to calculate the difference between two dates using VB.NET”

Leave a Reply