两个时间相加,以60进制计算
2009-09-15 08:56
555 查看
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim time1 As String = "123.12" Dim time2 As String = "123.56" Dim time3 As String = "000.12" Dim time4 As String = "000.12" Dim time5 As String = "000.13" Dim total As String = "" total = AddTime(time1, time2) 'total = AddTime(total, time3) 'total = AddTime(total, time4) 'total = AddTime(total, time5) Me.TextBox3.Text = total End Sub Public Function AddTime(ByVal CurrentValue As String, ByVal PreviousValue As String) As String If Not CurrentValue.Contains(".") Then CurrentValue = CurrentValue + ".00" End If Dim temp As String = CurrentValue Dim temp1() As String = temp.Split(".") Dim temp1_Integer As String = temp1(0) Dim temp1_Decimal As String = "0." + temp1(1) Dim temp2() As String = PreviousValue.Split(".") Dim temp2_Integer As String = temp2(0) Dim temp2_Decimal As String = "0." + temp2(1) Dim total_Integer As Integer = Integer.Parse(temp1_Integer) + Integer.Parse(temp2_Integer) Dim total_2Decimal As Single = Format(Single.Parse(temp1_Decimal) + Single.Parse(temp2_Decimal), "0.00") Dim total As String = "" If total_2Decimal >= 0.6 Then total = (total_Integer + 1) + Format((total_2Decimal - 0.6), "0.00") Else total = total_Integer + Format(total_2Decimal, "0.00") End If total = Format(Single.Parse(total), "000.00").ToString() Return total End Function
相关文章推荐
- 华为OJ:计算两个自然时间相加
- .net中时间相加,60进制
- 华为OJ:计算两个自然时间相加
- Python实现计算两个时间之间相差天数的方法
- PHP计算两个时间戳相隔的时间(具体到小时数)
- 编写一个程序,实行两个时间相加
- js 计算两个时间的时间差
- Oracle中计算两个时间的时间差:
- 在excel中如何计算两个时间之间的差[转]
- 计算两个日期的时间差,输出它们之间的天数
- C#中使用TimeSpan计算两个时间的差值
- PHP年龄计算 取得两个时间戳相差的年龄年月日显示
- iOS 计算两个时间的时间差
- 两个相邻时间之间的差值计算
- 计算两个时间之间的时间差
- 415. Add Strings (计算由两个字符串表示的数字相加之和)
- Android倒计时:计算两个时间将得到的时间差转化为倒计时(xx时xx分xx秒格式)
- 常用PHP函数系列八:计算两个时间戳之间的日期(常用于倒计时计算时间)
- 计算两个时间戳型的时间差
- 计算格式为YYYY-MM-DD HH:ii:ss的两个时间,相差多少年、多少月、多少日、多少小时、多少分钟、多少秒?