Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
VB.Net: difference in days between 2 dates
From Wiki
You will need a timespan object for this.
- Module Module1
- Sub Main()
- Dim _Date1 As New Date(2008, 7, 10)
- Dim _Date2 As New Date(2007, 5, 11)
- Console.WriteLine("Date 1 = " & _Date1.ToString("dd/MM/yyyy"))
- Console.WriteLine("Date 2 = " & _Date2.ToString("dd/MM/yyyy"))
- Dim _Date3 As TimeSpan = _Date1 - _Date2
- Console.WriteLine("the difference is")
- Console.WriteLine("days: " & _Date3.Days)
- Console.ReadLine()
- End Sub
- End Module
result




LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.