I am creating a Time Sheet Calculator Application and just need to find out how to add numbers that are in hourly form. For example 2:39 (two hours and thirty nine minutes). I know how t开发者_高级运维o create code for simple addition of decimal numbers, but does VB 2010 have some kind of way of adding hours and returning a number in hourly form. Thank you
Try the TimeSpan type ....
Dim ts1 As New TimeSpan(2, 39, 0)
Dim ts2 As New TimeSpan(3, 40, 0)
Dim ts3 = ts1 + ts2
MessageBox.Show(ts3.ToString)
i.e 2:39 + 3:40 = 6:19
精彩评论