<DllImport("coredll.dll")> _
Private Function SetSystemTime(ByRef time As SYSTEMTIME) As Boolean
End Function
Public Sub setDeviceDateTime(ByVal dt As DateTime)
Dim ServerTime As New SYSTEMTIME
ServerTime.Day = dt.ToUniversalTime.Day
ServerTime.Month = dt.ToUniversalTime.Month
ServerTime.Year = dt.ToUniversalTime.Year
ServerTime.Hour = dt.ToUniversalTime.Hour
ServerTime.Minute = dt.ToUniversalTime.Minute
ServerTime.Second = dt.ToUniversalTime.Second
SetSystemTime(ServerTime)
End Sub
Public Structure SYSTEMTIME
Public Year As Short
Public Month As Short
Public DayOfWeek As Short
Public Day As Short
Public Hour As Short
Public Minute As Short
Public Second As Short
Public Milliseconds As Short
End Structure
No comments:
Post a Comment