Time Zone

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?
thydAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mcriderCommented:
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
thydAuthor Commented:
Thank-you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.