≡ Menu

Set time zone from command line (CMD)

Time zone setting allows us to set the time according to the geographical location the computer is located at. We can change the time zone of a computer in Date and Time properties window which can be opened by running timedate.cpl from Run window.

Few readers of the blog have put this question to me. Is it possible to set the time zone from command line? 

The answer varies depending on which Windows edition you have. In Windows 7, we have a command called tzutil using which we can easily change time zone from windows command line. In Windows XP, it’s bit complicated.

Windows 7

You can run the below command to set timezone in Windows 7.

tzutil /s  "Time zone Identifier"

Examples:

Command to set time zone to Pacific Standard Time:

tzutil /s "Pacific Standard Time"

Command to set time zone to Central America standard time:

tzutil /s "Central America Standard Time"

Get the current time zone

We can find the current time zone by running the following command.

tzutil /g

Example:

c:\>tzutil /g
Pacific Standard Time
c:\>

Get the list of time zones

Run the command ‘tzutil /l‘ to get the list of time zones available.

Windows XP/Server 2003

While searching for a solution to this problem I got to know that there is a Windows Resource kit tool called timezone.exe which can be used to change day light savings..It does not set time zone. I tried further to find if there is any registry hack and below is what I came up with.

I found that the below registry key stores the information about different time zones.  

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones.

There is another registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation which has information about the current time zoneThis registry has the following information on my computer.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
Bias        REG_DWORD       0x1e0
StandardName        REG_SZ  Pacific Standard Time
StandardBias        REG_DWORD       0x0
StandardStart       REG_BINARY      00000B00010002000000000000000000
DaylightName        REG_SZ  Pacific Daylight Time
DaylightBias        REG_DWORD       0xffffffc4
DaylightStart       REG_BINARY      00000300020002000000000000000000
ActiveTimeBias      REG_DWORD       0x1e0

Now it’s clear that in order to change the time zone we need to put right data in these registry values.

Now the question is how to get these values for the time zone you want to set? It’s very simple. You just need to set the time to your desired time zone using GUI (timedate.cpl) and then capture the registry values by exporting the registry key TimeZoneInformation to a reg file.   Whenever you want to set the time zone from command line just run the exported .reg file and then reboot the machine to make the changes effective.  You can run the .reg command from a batch file also.

The above method works for all Windows versions – XP, Windows 7, Server 2003 and Server 2008.

There’s another method in circulation for setting time zone from command prompt.

RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Central Standard Time

When I had tested the command on XP, I found that it does not work for all the timezones. In Windows 7, it does not work at all. It just opens the time and date configuration window.

13 comments… add one
  • German XP fan

    CONTROL.EXE TIMEDATE.CPL,,/Z W. Europe Standard Time
    y tests showed that this does not work if you use the names that are shown in the XP timezone dialog. It seems that those are only display names.
    When I used the names for the subkey of
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
    it worked well. Those names are all English and it seems that XP needs that.

  • Anonymous

    Hi,

    Your solution of changing time zone works very nicely. But to reflect changes made in registry we have to restart the machine. Is there anyway to immediately reflect updated timezone change setting without reboot ?

    Thanks

    • admin

      I could not find any way of changing timezone from cmd without causing a reboot.

  • POP

    Hi,

    You could try:

    RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters

    in a cmd window.

  • POP

    or, just found out —> you can use the tzutil.exe in Windows 7.

    tzutil /s “gmt standard time”

    Changes the time zone to gmt and changes are instant.

    Hope this helps.

    • admin

      Thank you for sharing this.

  • Ram

    Thanks a ton guys..
    saved my time.Really helpfull.

    I had to do for around 50 machiens.with the Psexec and the command mentioned above i was able to do it with Ease.

    Ram

    • ahmed

      dear Ram,

      could you please advise me with the command line, how did you use it with psexec ??

  • tun

    thanks , ur sharing …Great!!

  • Matt

    RunDLL32.exe shell32.dll,Control_RunDLL timedate.cpl,,/Z Atlantic Standard Time

    Worked great for Windows Server 2003!

  • KIm

    What if I just wanted to get the timezone of the currentdate in London ? My friend share me this code in UNIX TZ=Europe/London date +%Z but I need the cmd command

  • EzIttaKert

    For Windows:
    Use “tzutil /l” command which prints out every valid timezone in the system (cities will be included as well)

    After you decided which is the correct timezone for you, copy the rigth one from tzutil /l output behind “tzutil /g” command.
    Use “tzutil /?” for further usage details

    You may also use or “systeminfo | findstr /L “Zone:”” to check your current settings, but the mentioned tzutil/g will also do the job.

    When you want to check your system logs, do not forget that these changes will be also applied on your system logging information (kind of obvious, but you might not keep this in mind on your vacation).

  • carlos

    hi there,

    I have a lot of servers with windows server 2003 to which the clock must move forward or backward one hour due to daylight saving time changes. I need you to help me with a command either powershell or cmd to save a scheduled time change task. In spring – summer the time zone is at (GMT-03: 00) Santiago but in autumn – winter the time zone should be at (GMT-04: 00) Georgetown, La Paz, Manaus, San Juan

    tzutil does not work on windows server 2003

Leave a Comment