-
time diff
Hi
I am using 24hours time format. And able to retrive the working hours and minutes within the time schedule from 1 am to 24 pm but if the shift start from 20 hrs to 6 am than unable to calculate the time ..
Code:
Dim TotalHours As Double
Dim TotalMinutes As Double
TotalMinutes = DateDiff(DateInterval.Minute, CDate(txtShiftFrom.Text), CDate(txtShiftto.Text))
TotalHours = Math.Round(TotalMinutes / 60, 0)
txtTotalWorkingHours.Text = TotalHours
txtMinutes.Text = TotalMinutes
Pls help how solve the problem
-
Re: time diff
Code:
Dim date1 As New System.DateTime(2007, 3, 1, 20, 1, 0)
Dim date2 As New System.DateTime(2007, 3, 2, 6, 0, 0)
Dim diff1 As System.TimeSpan
' 20:01 - 06:00
' diff1 gets 9 hours, and 58 minutes.
diff1 = date2.Subtract(date1)
Debug.Print("TotalHours " & diff1.Hours)
Debug.Print("TotalMinutes " & diff1.Minutes)