G
gmazza
Hey there,
I have the following code in a module that I am calling the GetZuluTime() in
a text field on a form and my time is Mountain time, and its 4pm here now and
it is showing up as 10pm for some reason.
What I want is when a user NOT in my time zone uses this form, it needs to
record the time of their updates in a table. See anything wrong??
Private Const LOCALE_SYSTEM_DEFAULT& = &H800
'**********************************
'** Type Definitions:
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 Declare Sub GetSystemTime Lib "Kernel32" (lpSystemTime As SYSTEMTIME)
Private Declare Function GetTimeFormat& Lib "Kernel32" Alias _
"GetTimeFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, _
lpTime As SYSTEMTIME, ByVal lpFormat As Long, _
ByVal lpTimeStr As String, ByVal cchTime As Long)
Public Function GetZuluTime() As Date
Dim myTime As SYSTEMTIME
Dim strBuffer As String
Dim lng As Long
Dim strSystemTime As String
GetSystemTime myTime
strBuffer = String$(255, Chr$(0))
lng = GetTimeFormat&(LOCALE_SYSTEM_DEFAULT, 0, myTime, _
0, strBuffer, 254)
With myTime
GetZuluTime = DateSerial(.wYear, .wMonth, .wDay) _
+ CDate(strBuffer)
End With
End Function
I have the following code in a module that I am calling the GetZuluTime() in
a text field on a form and my time is Mountain time, and its 4pm here now and
it is showing up as 10pm for some reason.
What I want is when a user NOT in my time zone uses this form, it needs to
record the time of their updates in a table. See anything wrong??
Private Const LOCALE_SYSTEM_DEFAULT& = &H800
'**********************************
'** Type Definitions:
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 Declare Sub GetSystemTime Lib "Kernel32" (lpSystemTime As SYSTEMTIME)
Private Declare Function GetTimeFormat& Lib "Kernel32" Alias _
"GetTimeFormatA" (ByVal Locale As Long, ByVal dwFlags As Long, _
lpTime As SYSTEMTIME, ByVal lpFormat As Long, _
ByVal lpTimeStr As String, ByVal cchTime As Long)
Public Function GetZuluTime() As Date
Dim myTime As SYSTEMTIME
Dim strBuffer As String
Dim lng As Long
Dim strSystemTime As String
GetSystemTime myTime
strBuffer = String$(255, Chr$(0))
lng = GetTimeFormat&(LOCALE_SYSTEM_DEFAULT, 0, myTime, _
0, strBuffer, 254)
With myTime
GetZuluTime = DateSerial(.wYear, .wMonth, .wDay) _
+ CDate(strBuffer)
End With
End Function