Count Number Of Days Between Two Dates And Display Date in VB.NET

Count Number Of Days Between Two Dates And Display Date in VB.NET.

Dim dt1 As DateTime = Convert.ToDateTime(DateTimePicker1.Value.ToString("dd/MM/yyy"))

Dim dt2 As DateTime = Convert.ToDateTime(DateTimePicker2.Value.ToString("dd/MM/yyy"))

''count total day between selected your date

Dim ts As TimeSpan = dt2.Subtract(dt1)
 

 If Convert.ToInt32(ts.Days) >= 0 Then

   For index = 0 To ts.Days

   ''get date string one by one

   Dim ds As String = dt1.AddDays(index)

 Next
 

 Else

   MessageBox.Show("Please Check It's Invalid Input")

 End If

 

Ebook Download
View all
Learn
View all