设置系统时间

Declare Function SetLocalTime 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

Public Function SetTime(ByVal y As Integer, ByVal m As Integer, ByVal d As Integer, _
    ByVal h As Integer, ByVal n As Integer, ByVal s As Integer) As Boolean
   
    Dim lpSystemTime As SystemTime
   
    With lpSystemTime
        .wYear = y
        .wMonth = m
        .wDay = d
        .wHour = h
        .wMinute = n
        .wSecond = s
        .wMilliseconds = 0
    End With
   
    SetTime = CBool(SetLocalTime(lpSystemTime))
End Function

原文地址:https://www.cnblogs.com/lbnnbs/p/4784608.html