mohamad guntur

mohamad guntur

  • NA
  • 40
  • 40.7k

Calculate days using timespan between 2 Datetimepicker

Oct 28 2012 10:48 PM
I use this code and nothing works out :((


Dim FirstDate As Date
        Dim SecondDate As Date
        Dim ts As TimeSpan
        Dim diff As Integer
        FirstDate = DateTimePicker1.Value
        SecondDate = DateTimePicker2.Value
        ts = SecondDate - FirstDate

        If txtTOTAL_DAYS.Text = "" Then
            diff = ts.Days
            txtTOTAL_DAYS.Text = diff.ToString()
        End If

    End Sub



how to calculate timespan between 2 Datetimepicker? after the user select those datetimepicker, then the txtTOTAL_DAYS show automatically the total days between 2 datetimepicker.


Saturday and Sunday doesn't need to count.