Hi guys,
How should I get the result as 1 hour and 10 minutes here ?Code:? dateDiff("n","08:30","09:40")/60
1.1666666666666667 --result
Thank you
Printable View
Hi guys,
How should I get the result as 1 hour and 10 minutes here ?Code:? dateDiff("n","08:30","09:40")/60
1.1666666666666667 --result
Thank you
Don't use DateDiff. Whether you're using DateTime values or TimeSpan values (which you should be using one of) then you can simply subtract one from the other to get a TimeSpan that represents the difference.vb.net Code:
Dim start As New TimeSpan(8, 30, 0) Dim finish As New TimeSpan(9, 40, 0) Dim difference As TimeSpan = finish - start MessageBox.Show(String.Format("{0}:{1:00}", difference.Hours, difference.Minutes), "Difference")