shell "net time \\主机Name>c:\\time.txt",vbhide然后分析time.txt
如果这台机器有iis就能这样解决 Option Explicit
Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Type SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type
Private Sub Form_Load() Dim lpSystemTime As SYSTEMTIME Dim currentTime As Date Dim xDate As String
Inet1.Execute "ip地址", "post" Do While Inet1.StillExecuting DoEvents Loop
Option Explicit
Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Sub Form_Load()
Dim lpSystemTime As SYSTEMTIME
Dim currentTime As Date
Dim xDate As String
Inet1.Execute "ip地址", "post"
Do While Inet1.StillExecuting
DoEvents
Loop
xDate = Mid(Inet1.GetHeader("Date"), InStr(1, Inet1.GetHeader("Date"), ",", vbTextCompare) + 1)
xDate = Trim(Left(xDate, InStr(1, xDate, "GMT", vbTextCompare) - 1))
currentTime = CDate(xDate)
With lpSystemTime
.wYear = DatePart("yyyy", currentTime)
.wMonth = DatePart("m", currentTime)
.wDay = DatePart("d", currentTime)
.wHour = DatePart("h", currentTime)
.wMinute = DatePart("n", currentTime)
.wSecond = DatePart("s", currentTime)
.wMilliseconds = 0
End With
Call SetSystemTime(lpSystemTime)
Me.Print "GMT:" & currentTime
Me.Print "SYS:" & Date & " " & Time
End Sub