请教,北京时转换成国际时程序如何编,特急,在线等,100求解。
国际时比北京时慢8个点。

解决方案 »

  1.   

    Dim n As Date
    n = "2006-6-13 13:34"
    Dim b As Date
    b = DateAdd("h", -8, n)
      

  2.   

    Private Sub Command1_Click()
      Debug.Print ChDate(#6/13/2006 1:34:20 PM#, -8) '北京时间是东8区,所以国际时间是我们的前8小时
    End Sub
    Public Function ChDate(Ndate As Date, DiffNo As Integer) As Date
          ChDate = DateAdd("H", DiffNo, Ndate)
    End Function
      

  3.   

    Private Sub Command1_Click()
    Dim D As Date
    D = Now()
    MsgBox Format(D - 8 / 24, "DDD,DD MMM YYYY HH:NN:SS") & " GMT"
    End Sub
      

  4.   

    使用 DateAdd("h", -/+时差, now)  就可以了
      

  5.   

    楼上的都对但是有一个问题:这样做把时间和当前机器的时区分开处理了,我们是假定了用户的机器是东北区的设置。
    有方法可以直接把当前机器时区和当前时间结合得出来一个GMT时间吗?
    我记得JAVASCRIPT是可以的。
      

  6.   

    机器上和程序只能取本机器上设置的时间,也就是某一时区的时间。Javascript也不可能取非本机器的时间,对于Js中的Date对象,比如:
    d=new Date()
    d=new Date(dV)
    第一行是取当前机器的时间,与VB的now相同,第二行是指定日期与 1970 年 1 月 1 日午夜间全球标准时间的毫秒数dV,VB中有相当的DateDiff函数。
      

  7.   

    Public Declare Function GetTimeZoneInformation Lib "kernel32" Alias "GetTimeZoneInformation" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As LongPublic Type TIME_ZONE_INFORMATION
            Bias As Long
            StandardName(32) As Integer
            StandardDate As SYSTEMTIME
            StandardBias As Long
            DaylightName(32) As Integer
            DaylightDate As SYSTEMTIME
            DaylightBias As Long
    End Type'用法:
    Dim tmz As TIME_ZONE_INFORMATION
    Dim UTC As DataTime
    Call GetTimeZoneInformation(tmz)UTC = Now() + tmz.Bias
      

  8.   

    可以使用API LocalTimeToFileTime + FileTimeToSystemTime(直接由LocaTime和SystemTime转换的不记得了^_^).