Option ExplicitPrivate Sub Command1_Click() Dim DateOne As Date Dim DateTwo As Date DateOne = CDate("2010-12-8 20:45:30") DateTwo = CDate("2011-02-12 20:05:15") Debug.Print DateDiff("d", DateOne, DateTwo) End Sub
Option ExplicitSub Main() Dim dtLocal As Date Dim dtGMT As Date
dtLocal = Now() Debug.Print "北京时间", dtLocal dtGMT = DateAdd("h", -8, dtLocal) Debug.Print "格林威治时间", dtGMT End Sub Option ExplicitSub Main() Dim dtLocal As Date Dim dtGMT As Date
dtLocal = Now() Debug.Print "北京时间", dtLocal dtGMT = DateAdd("h", 4, dtLocal) Debug.Print "斐济时间", dtGMT End Sub
Option ExplicitPrivate Sub Command1_Click()
Dim DateOne As Date
Dim DateTwo As Date DateOne = CDate("2010-12-8 20:45:30")
DateTwo = CDate("2011-02-12 20:05:15")
Debug.Print DateDiff("d", DateOne, DateTwo)
End Sub
Dim dtLocal As Date
Dim dtGMT As Date
dtLocal = Now()
Debug.Print "北京时间", dtLocal
dtGMT = DateAdd("h", -8, dtLocal)
Debug.Print "格林威治时间", dtGMT
End Sub
Option ExplicitSub Main()
Dim dtLocal As Date
Dim dtGMT As Date
dtLocal = Now()
Debug.Print "北京时间", dtLocal
dtGMT = DateAdd("h", 4, dtLocal)
Debug.Print "斐济时间", dtGMT
End Sub
只要TCP协议链接成功,服务器立即就返回时间了,连数据都不需要发送...时间服务器可以通过搜索,也可以用time.windows.com,time.nist.gov...