Hi all
I want to be able to calculate the difference between two dates, written in SQL db. The difference must be in days/hours format. This is my code:

Dim SQLConn As New SqlConnection()
        Dim SQLCmd As New SqlCommand()
        Dim dr As SqlDataReader
		Dim arrival As Date
        Dim departure As Date
        SQLConn.ConnectionString = ConnString

        SQLCmd.Connection = SQLConn
        SQLCmd.CommandText = sqlstr
        dr = SQLCmd.ExecuteReader
		While dr.Read()
		arrival= dr.Item("ODHOD")
        departure = dr.Item("PRIHOD")
	    End While


I've read timespan is one of the options to use for this case but don't know exactly how to do it..?
Any help would be appreciated.

I decided it's probably easyer for me to work a way arroun. I have calculated dates from datetimepickers on another form, write diff to base and on another form just got this data out.
I used this code:

Dim odhod As Date = DateTimePicker1.Value

        Dim prihod As Date = DateTimePicker2.Value
        Dim razlika As TimeSpan
        razlika = prihod.Subtract(odhod)

        'MessageBox.Show(razlika.Days.ToString() & "/" & razlika.Hours.ToString())
This question has already been answered. Start a new discussion instead.