Link to home
Start Free TrialLog in
Avatar of Joe_Shen
Joe_Shen

asked on

Disable daylight savings time

Hi,

Any one knows how to disable or uncheck "Automatically adjust clock for daylight saving changes" in Time Zone settings?

Thanks a lot.

Joe
Avatar of mugman21
mugman21

Sure thing,

You need to change it in your registry. The key that needs to be changed is outlined here:

http://www.winguides.com/registry/display.php/1283/

I don't know how much programming experiance you have, if you need a little help in registry writes, just ask...

Mugman
Avatar of Joe_Shen

ASKER

Thanks a lot, Mugman.

Sorry for reply late since I was tighted up with something else.

I am just VB beginner, could you email me some codes of  how to get this done? my email is:
zqshen@juno.com

Again, Thank you for your help.

Joe

Joe, I'll post some code here along with a link to the need class module just so this question can be PAQ'ed for others that might want to know this. I'll zip the sample project and email it to you.

Mugman
To create a project that will test whether automatic daylight savings is enabled or disabled, first download the class module from
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=57232&lngWId=1

Create a project, add a form and two command buttons using the default names. Add the following code to Form1:

'-----------------------------------------------------------------------------------------------------------------------------------

Dim reg As clsRegistryAccess

Private Sub Form_Load()
'create the object
Set reg = New clsRegistryAccess
End Sub

Private Sub Command1_Click()
Dim DoesExist As Boolean
Dim KeysValue As Long

'determine if the key even exist
DoesExist = reg.ValueExists("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "DisableAutoDaylightTimeSet")

If DoesExist = False Then
'if the keyvalue does not even exist, = false, then daylightsavings is on by default
MsgBox "This system will automatically adjust for daylightsavings"
Else
'if key does exist, lets read it and check it's value
KeysValue = reg.ReadDWORD("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "DisableAutoDaylightTimeSet")

If KeysValue = 0 Then
MsgBox "daylightsavings is enabled"
ElseIf KeysValue = 1 Then
MsgBox "daylightsavings is disabled"
End If

End If
End Sub

Private Sub Command2_Click()
'if the key exist, we'll rewrite over it or if not, we'll create and set it
reg.CreateKeyIfDoesntExists = True
reg.WriteDWORD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "DisableAutoDaylightTimeSet", 1

End Sub
and if it is Enabled, click Command2 and it will create the appropriate key and disable it.....

Mugman
ASKER CERTIFIED SOLUTION
Avatar of mugman21
mugman21

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks, Mugman

Your codes work perfectly. Sorry for late reply again.

Wish you the best.

Joe