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 Declare Function SetSystemTime Lib "kernel32" (ByRef lpSystemTime _ As SYSTEMTIME) As Long Declare Function VariantTimeToSystemTime Lib "oleaut32"(ByVal vtime As Date, _ ByRef lpSystemTime As SYSTEMTIME) As Long Declare Function SystemTimeToVariantTime Lib "oleaut32"(ByRef lpSystemTime As SYSTEMTIME, ByRef vtime As Date) As Long Declare Function GetSystemTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As Long Declare Function GetLocalTime Lib "kernel32" (ByRef lpSystemTime As SYSTEMTIME) As Long Function GetDateTimeUTC() As Date Dim systime As SYSTEMTIME Dim vartime As Date GetSystemTime systime Print "************* SYSDATE ****************" Print "systime.wYear: " & systime.wYear Print "systime.wMonth: " & systime.wMonth Print "systime.wDay: " & systime.wDay Print "systime.wDayOfWeek: " & systime.wDayOfWeek Print "systime.wDay: " & systime.wDay Print "systime.wHour: " & systime.wHour Print "systime.wMinute: " & systime.wMinute Print "systime.wSecond: " & systime.wSecond Print "systime.wMilliseconds: " & systime.wMilliseconds Print "****************************************" If SystemTimeToVariantTime(systime, vartime) = 0 Then Print "SystemTimeToVariantTime failed" Else GetDateTimeUTC = vartime End If End Function Function GetDateTimeLocal() As Date Dim localtime As SYSTEMTIME Dim vartime As Date GetLocalTime localtime Print "************* SYSDATE ****************" Print "systime.wYear: " & systime.wYear Print "systime.wMonth: " & systime.wMonth Print "systime.wDay: " & systime.wDay Print "systime.wDayOfWeek: " & systime.wDayOfWeek Print "systime.wDay: " & systime.wDay Print "systime.wHour: " & systime.wHour Print "systime.wMinute: " & systime.wMinute Print "systime.wSecond: " & systime.wSecond Print "systime.wMilliseconds: " & systime.wMilliseconds Print "****************************************" If SystemTimeToVariantTime(localtime, vartime) = 0 Then Print "SystemTimeToVariantTime failed" Else GetDateTimeLocal = vartime End If End Function