IN MY FORM THERE IS TWO DATATIMEPICKER AND ONE BUTTON
WHILE CLICKING THE BUTTON MESSAGE SHOULD DISPLAY TIME DIFFERENCE BETWEEN TWO DATETIMEPICKER.............................................. ANY ONE HELP ME BY SENDING CODING

Here is the code for getting the dates of two datetimepickers, finding the difference of the two dates and then displaying the days, hours, minutes and seconds of the difference in dates. This code displays the result in the text of the form.

Dim date1 As Date
        Dim date2 As Date
        date1 = Convert.ToDateTime(DateTimePicker1.Value)
        date2 = Convert.ToDateTime(DateTimePicker2.Value)

        Dim diff As System.TimeSpan
        diff = date2 - date1

        Me.Text = diff.Days & ":" & diff.Hours & ":" & diff.Minutes & ":" & diff.Seconds
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.