Get time difference between two timespan in vb.net

后端 未结 3 1658
夕颜
夕颜 2020-12-18 00:30

I have two variables :

Dim starttime As TimeSpan
Dim endtime As TimeSpan

My starttime value is : 02:30:00 (I mean 2.30AM)
2.30AM is nex

3条回答
  •  感动是毒
    2020-12-18 01:20

    HERE IS MY SOLUTION FOR DIFFERENCE IN HOURS

            'WORKS ONLY TIME SPAN WITHIN 48 HRS
            Dim HRS As TimeSpan
            Dim St As TimeSpan = TimeSpan.Parse(L_A_START.Text)
            Dim Cl As TimeSpan = TimeSpan.Parse(L_A_CLOSE.Text)
    
            HRS = Cl - St
    
            If HRS.Hours <= 0 Then
                HRS = (HRS + New TimeSpan(0, 24, 0, 0, 0))
            End If
    
            L_A_HRS.Text = HRS.ToString()
    

提交回复
热议问题