472,353 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

How to change computer's "Time Zone" from vb.net

please help.
I want to be able to change my computer's system "Time Zone" via vb.net
code. is it possible?

-mike
May 30 '06 #1
1 8075
On Tue, 30 May 2006 16:38:04 +0800, "Michael Barrido"
<jm***@hotmail.com> wrote:
please help.
I want to be able to change my computer's system "Time Zone" via vb.net
code. is it possible?

-mike


The short answer is "Probably".

I had an old example of this written in VB6 for use in Win98.

The basis of the example uses the API, SetTimeZoneInformation which,
in Net, would be:

Public Declare Function SetTimeZoneInformation _
Lib "kernel32" (ByRef lpTimeZoneInformation _
As TIME_ZONE_INFORMATION) As Integer

However, the old TYPE definition for TIME_ZONE_INFORMATION would not
be valid for NT systems and NET.

Public 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

You would need to update this to a valid working Structure. I found 3
different versions using a quick "google", with this one looking the
most ominous:

Public Structure TIME_ZONE_INFORMATION
Dim Bias As Integer
<VBFixedString(64), System.Runtime.InteropServices. _
MarshalAs(System.Runtime.InteropServices. _
UnmanagedType.ByValTStr, SizeConst:=64)> _
Public StandardName As String
Dim StandardDate As SYSTEMTIME
Dim StandardBias As Integer
<VBFixedString(64), System.Runtime.InteropServices. _
MarshalAs(System.Runtime.InteropServices. _
UnmanagedType.ByValTStr, SizeConst:=64)> _
Public DaylightName As String
Dim DaylightDate As SYSTEMTIME
Dim DaylightBias As Integer

End Structure

TimeZone definitions for a given system are found in the registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time
Zones
Theoretically, you should be able to set the system time zone to any
one of those named Time Zones.

Long answer: Yes, but would depend on you NET skill level.
Gene
May 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jason Priebe | last post by:
I posted earlier with a very complex example. This simple one gets to the point much faster. timeofday() seems to behave inconsistently when the...
2
by: Paul Brady | last post by:
I have non-computer skilled users entering data into a form. There are certain ranges of values which, if they enter them, make no sense in the...
10
by: David Garamond | last post by:
The Postgres manual says: The AT TIME ZONE construct allows conversions of time stamps to different time zones. I'd guess most people would...
16
by: John Kelsey | last post by:
Back in the "old" days with C, I used to do something like... struct { char Description; float price; } Items = { {"Apple", 1.99},...
0
by: Andrew Morton | last post by:
Windows Server 2003 SP1, IIS6.0, .NET1.1, VS2003 I got the "URL Is In the Internet Zone" error when trying to debug an ASP.NET application, with...
0
by: Shaun | last post by:
Hi all, I'm trying to implement a custom session handler that writes session data to a MySQL database. It works fine about 99% of the time....
13
by: MLH | last post by:
Would like to run the control panel's Internet Date & Time program from VBA - emulating opening it, clicking the Internet Time tab and the Update...
1
by: princessjewel62 | last post by:
I would like to ask anyone out there, where can I find the "Local Internet Zone" as I had a problem with my application not displaying and saying...
2
by: André | last post by:
Hi, When clicking on "remember me" when logging, the user asks for not to have to log in next time he visits the site. Now, on one side, i...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.