View Single Post
  #2  
Old April 9th, 2009, 01:54 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Greenwich GMT Date and Time problem

What's actually in strBuffer after your call to GetTimeFormat?

You might take a look at http://www.mvps.org/access/api/api0024.htm at "The
Access Web" to ensure you're also handling daylight savings time properly.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"gmazza" u37142@uwe wrote in message news:94446eb6ff00f@uwe...
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

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200904/1