VB.net Program to Print the Difference of Two Dates in Days

You are currently viewing VB.net Program to Print the Difference of Two Dates in Days

VB.Net program to print the difference of two dates in days

'VB.NET program to print difference of two dates in days.

Imports System

Module Module1
    Sub Main()
        Dim diff As TimeSpan
        Dim date1 As New DateTime(2020, 3, 22)
        Dim date2 As New DateTime(2021, 5, 25)

        diff = date2 - date1

        Console.WriteLine("Days: {0}", diff.TotalDays)
    End Sub
End Module
Days: 429
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply