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?

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?


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 _

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

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:

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
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.
May 31 '06 #2

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

Similar topics

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...
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...
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...
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},...
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...
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....
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...
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...
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...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
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...
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...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
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...
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...
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...
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...
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.