|
-
July 21st, 2010, 03:18 AM
#1
Need Help displaying local time zone, please.
Hi 
I would like to know how I can display the local time zone in a label but not just the GMT offset, I want the whole deal like Windows does.
example: (GMT+/- offset)nameofcity
Thanks to a snippet I found online I am able to populate a listbox with all of the Windows XP dafault time zones however I can't work out how to extract just the local TZ from the system.
I'm using VB6, MSDN is way over my head as I'm not up to speed with the lingo. 
I learn better by example(s).
Any help would be greatly appreciated. Thank you.
BTW, I already have a Mod with the following:
Code:
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 REGTIMEZONEINFORMATION
Bias As Long
StandardBias As Long
DaylightBias As Long
StandardDate As SYSTEMTIME
DaylightDate As SYSTEMTIME
End Type
Private Type TIME_ZONE_INFORMATION
Bias As Long
StandardName(31) As Integer
StandardDate As SYSTEMTIME
StandardBias As Long
DaylightName(31) As Integer
DaylightDate As SYSTEMTIME
DaylightBias As Long
End Type
Private Const TIME_ZONE_ID_INVALID = &HFFFFFFFF
Private Const TIME_ZONE_ID_UNKNOWN = 0
Private Const TIME_ZONE_ID_STANDARD = 1
Private Const TIME_ZONE_ID_DAYLIGHT = 2
Private Declare Function GetTimeZoneInformation Lib "kernel32" _
(lpTimeZoneInformation As TIME_ZONE_INFORMATION) As Long
Last edited by AccadaccA; July 21st, 2010 at 09:26 PM.
Reason: UNRESOLVED
-
July 21st, 2010, 03:29 AM
#2
Re: Need Help displaying local time zone, please.
Please us e[CODE] and [/CODE] tags when posting code.
-
July 21st, 2010, 03:57 AM
#3
Re: [RESOLVED] Need Help displaying local time zone, please.
Sorry for not using code tags.
I have found the answer, well at least something I can work with to get the desired info.
http://vbnet.mvps.org/code/locale/ti...biaslookup.htm
-
July 21st, 2010, 04:04 AM
#4
Re: [RESOLVED] Need Help displaying local time zone, please.
Thanx for sharing your answer. It helps members in future with the same problem, to fix theirs 
Hannes
-
July 21st, 2010, 09:11 PM
#5
Re: [RESOLVED] Need Help displaying local time zone, please.
I jumped the gun a little thinking that my problem was resolved. Although the link points to a good script it still doesn't return the results I'm after.
I am in Brisbane, Australia which is GMT + 10:00, however it appears that all scripts relating to Regional Time Zones return the offset value of "-600" on my system, where it should read "+600" minutes which throws it out by 1200 minutes / 20 hours. Not exactly accurate, hey?
Now going back to my original post, we know that there is a way of getting what I'm after as Windows does it during the setup process and a snippet of a script by Paul Turcksin populates a listbox with all of the Regional Time Zones in the same format.
I had included a snippet of his code below but then read that it was forbidden to do so without his written consent. Unfortunately he failed to include his email address.
So the question is does anybody here know of an API or registry call that will return the following:
example: (GMT+/- offset)nameofcity
as in: (GMT +10:00) Brisbane
or: (GMT -06:00) Central Time (US & Canada)
etc.
Thank you for you tolerance.
-
July 21st, 2010, 10:50 PM
#6
Re: [RESOLVED] Need Help displaying local time zone, please.
-
July 22nd, 2010, 01:34 AM
#7
Re: [RESOLVED] Need Help displaying local time zone, please.
One nice thing about VB.Net is UTCDateTime
-
July 22nd, 2010, 02:53 AM
#8
Re: Need Help displaying local time zone, please.
I edited the thread title back to normal
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|