How can I retrieve GMTwithout calculating it in Access 2003?

D

Dick3425

I can calculate GMT using the differences in time but if the database is
moved it uses the system time fron the time zone it is in and then all the
formuals are incorrect? For Example EST -5 GMT.
 
K

Klatuu

First, go to this site. Copy the code and paste it into a standard module.

http://www.mvps.org/access/api/api0024.htm

Now, paste the following function into it. It will return GMT based on the
computer's time zone settting. You can pass it a specific date/time to use
or if you don't pass it a date/time value, it will use the system clock.

Public Function GetGMT(Optional ByVal LocalTime As Variant) As Date
Dim TZI As TIME_ZONE_INFORMATION
Dim dtmCurrentTime As Date
Dim lngRet As Long

If IsMissing(LocalTime) Then
LocalTime = Now
End If
lngRet = GetTimeZoneInformation(TZI)
GetGMT = DateAdd("n", TZI.Bias, LocalTime)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top