Solved

# Time Zone

Posted on 1999-11-01
Medium Priority
209 Views
How do you retrieve the time zone information from the system? For instance, now() can be used in vb to obtain the current time. How can you obtain the timezone?
0
Question by:thyd

LVL 32

Accepted Solution

Erick37 earned 400 total points
ID: 2175112
From MSDN:
"All translations between UTC time and local time are based on the following formula:

UTC = local time + bias

The bias is the difference, in minutes, between UTC time and local time."

EX:

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 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
Private Declare Function GetTimeZoneInformation Lib "kernel32" (lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long

Private Sub Command1_Click()
Dim lRet As Long
Dim tzi As TIME_ZONE_INFORMATION
lRet = GetTimeZoneInformation(tzi)
Debug.Print tzi.Bias / 60 & " hours from UTC"
End Sub
0

LVL 14

Expert Comment

ID: 2175128
Check out this Microsoft Article:

HOWTO: Change Time Zone Information Using Visual Basic
http://support.microsoft.com/support/kb/articles/Q221/5/42.ASP

Cheers!
0

Author Comment

ID: 2177510
Thank-you.
0

## Featured Post

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.

Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
###### Suggested Courses
Course of the Month11 days, 2 hours left to enroll