Windows regional time setting

I'm trying to customize an Access application that stores appointment date/times in a SharePoint list.

Unfortunately, I've got users all over the US that are using this application.  What I want to happen is that when the user selects 10am, and then saves the record, the value that actually gets saved will be in GMT.  So I need a way to convert a local time to GMT.  I'm assuming that the best way to do this is via an api call or by capturing a registry setting.  Just not sure how to accomplish this.

I'll either use the forms Current event or a conversion function in a query to convert the saved date/time back to local time for display purposes
LVL 50
Dale FyeAsked:
Who is Participating?
 
Nick67Connect With a Mentor Commented:
I'll go one better, since you need multiple zones across the continent
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_20877498.html
was the source
<singing, it's all been done before>
For my machine it returns "Mountain Daylight Time"

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

Type TIME_ZONE_INFORMATION
        Bias As Long
        StandardName(32) As Integer
        StandardDate As SYSTEMTIME
        StandardBias As Long
        DaylightName(32) As Integer
        DaylightDate As SYSTEMTIME
        DaylightBias As Long
End Type

Declare Function GetTimeZoneInformation Lib "kernel32.dll" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long

Function TimeZoneString() As String
' Display the name of the time zone the computer is set to.
Dim tzi As TIME_ZONE_INFORMATION  ' receives information on the time zone
Dim retval As Long  ' return value
Dim c As Long  ' counter variable needed to display time zone name
Dim TheZone As String

retval = GetTimeZoneInformation(tzi)  ' read information on the computer's selected time zone

' Oddly, instead of being stored in a string, the time zone name is stored in a
' 32-element array, each element holding the ASCII code of one of the characters.
' This loop converts the array into a readable string.
For c = 0 To 31  ' the array's range is from 0 to 31
  If tzi.StandardName(c) = 0 Then Exit For  ' abort if the terminating null character is reached
  TheZone = TheZone & Chr(tzi.StandardName(c)) ' convert the ASCII code into a character
Next c
TimeZoneString = TheZone
End Function


Form there, it's a select case structure and you're done
0
 
Rey Obrero (Capricorn1)Commented:
0
 
als315Commented:
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Gustav BrockCIOCommented:
Here is full code and how to do. Just pick the right page at EE:

Convert PST time to GMT

/gustav
0
 
Dale FyeAuthor Commented:
not abandoned, just side-tracked.  Will get back to you.
0
 
Dale FyeAuthor Commented:
Nick,

This worked like a charm.  Thanks

Don't know how I failed to close this sooner
0
 
Nick67Commented:
No problem
0
 
Nick67Commented:
No problem
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.