当前位置:编程学习 > C#/ASP.NET >>

VB中为System.TimeSpan类型的时间相减怎么转化为integer

VB中为System.TimeSpan类型的时间相减怎么转化为integer
先转换在相减也行 随便 只要能达到目的就行 。。
求帮助 --------------------编程问答--------------------  Shared Sub h()
        Dim i1 As System.TimeSpan
        Dim i2 As System.TimeSpan
        Dim i3 As System.TimeSpan
        Dim c1 As Long
        Dim c2 As Double
        Dim c3 As Integer
        Dim ts As TimeSpan = Now - New Date(1999, 12, 12, 21, 12, 13)
        c1 = ts.Ticks
        c2 = ts.TotalSeconds
        c3 = c2 '给int32赋值,小数部分四舍五入。
        i1 = System.TimeSpan.FromTicks(c1)
        i2 = System.TimeSpan.FromSeconds(c2)
        i3 = System.TimeSpan.FromSeconds(c3)
        Debug.Print("本身的时间:" & ts.ToString)
        Debug.Print("64位整型的时间:" & i1.ToString)
        Debug.Print("64位浮点的时间:" & i2.ToString)
        Debug.Print("32位整型的时间:" & i3.ToString)
    End Sub

用64位long值可以保存,32位int只能扔掉毫秒数。
补充:.NET技术 ,  VB.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,