473,545 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8247
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, SetTimeZoneInfo rmation which,
in Net, would be:

Public Declare Function SetTimeZoneInfo rmation _
Lib "kernel32" (ByRef lpTimeZoneInfor mation _

However, the old TYPE definition for TIME_ZONE_INFOR MATION 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(Syste m.Runtime.Inter opServices. _
UnmanagedType.B yValTStr, SizeConst:=64)> _
Public StandardName As String
Dim StandardDate As SYSTEMTIME
Dim StandardBias As Integer
<VBFixedString( 64), System.Runtime. InteropServices . _
MarshalAs(Syste m.Runtime.Inter opServices. _
UnmanagedType.B yValTStr, 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_MACH INE\SOFTWARE\Mi crosoft\Windows NT\CurrentVersi on\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 timezone is set with "GMT+X" notation. foo=> select cast(timeofday() as timestamp with time zone); set time zone 'GMT+4'; select cast(timeofday() as timestamp with time zone); timeofday...
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 application, but I can't test them until they try to close out the form, in which case I can look at the entire set of values and see if they're OK. So, I have this code. for the "Before Update"...
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 think what's meant here is something like "unit conversion", and that the timestamp value stays the same (much like 2 feet becomes 24 inches when it's being "converted"). But: # SELECT NOW() =...
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}, {"Banana", 2.04}
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 403.0 followed by 401.5 errors in the IIS log. I have several web sites set up on my computer, to get debugging to work I had to allow ASP.NET debugging for "Web Sites", not just the site I was...
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. Trouble is, at random intervals, I get entries like the following in my php-error.log: PHP Warning: Unknown: A session is active. You cannot change the session module's ini settings at this 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 Now button. I don't really care for the user to see all this. Would just like to sync the system time with the facility built-in to XP and automatically w/o asking the user to go through the...
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 that I have no authorisation to view this web page but indeed, I am the administrator. Thanks, Crystalite.
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 read it is recommended to logout properly (clicking on 'logout') when quiting the site, but then, the user looses the benefit of the option "remember me next time" and must login next visit. On the...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.