38

How can I set the timezone in Windows from command line or from a batch file?

Do I need to use powershell or cscript?

Eduard Florinescu
  • 16,747
  • 28
  • 113
  • 179

4 Answers4

68

The command line utility that helps you change the time zone in Windows 7 is tzutil.exe and is known as Windows Time Zone Utility. This is a great tool for all the people who prefer working from the command prompt.

Use the /s parameter to set the time zone:

tzutil /s "universal standard time"

Use the /g parameter to get the time zone:

tzutil /g

Use the /l parameter to list the valid time zones.

tzutil /l

[source]

Iain Samuel McLean Elder
  • 19,791
  • 12
  • 64
  • 80
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
3

If anyone still uses Windows XP (as I do):

Step 1:

You can use the following command line, e.g. in the "Execute" window (cmd):

Control.exe TIMEDATE.CPL,,/Z W. Europe Standard Time

Where "W. Europe Standard Time" is, not really surprisingly, for Western Europe. Other possible values are e.g.

  • E. Europe Standard Time (for Eastern Europe)
  • Pazifik Standard Time (for what it says)

and so on. A list of possible values can be found here (although for Windows Vista, but it seems most values are the same):

https://technet.microsoft.com/en-us/library/cc749073%28v=ws.10%29.aspx

Step 2

In order to run the above command from a shortcut, you can do the following:

Create a new shortcut (e.g. in Windows explorer, right-click anywhere in an empty area, and choose "New shortcut") and give it the following value (by entering the code into the window that opens, or as "target" in the accordingly named field):

C:\Windows\System32\cmd.exe /c Control.exe TIMEDATE.CPL,,/Z W. Europe Standard Time

(The example uses W. Europe Standard Time; change this to your liking)

Calling this shortcut (i.e. clicking the Icon) immediately changes the timezone.

For my needs, I created two such shortcuts, one setting the timezone to Western Europe, the other setting it to Eastern Europe, as these are the locations where I am working regularly.

(Source for Step 2: Run a Command Prompt command from Desktop Shortcut)

Community
  • 1
  • 1
  • @Christian, Is there a way to set [arbitrary timezones](http://stackoverflow.com/questions/4976696/how-do-i-test-my-browser-timezone-dependent-application-againts-different-timezo#comment60641257_4976769) like +15:00 GMT? – Pacerier Apr 09 '16 at 14:18
  • You mean, not calling specific time zone names (such as "Western Europe") but the time given in numbers (+15:00)? – Christian Geiselmann Apr 10 '16 at 14:59
  • @ChristianGeiselmann, I mean arbitrary timezones that exist outside of specific time zone names. See this comment: http://stackoverflow.com/questions/4976696/how-do-i-test-my-browser-timezone-dependent-application-againts-different-timezo#comment60641257_4976769 . E.g. +15:00 (note that there *isn't* really a +15:00) or +08:12 – Pacerier Apr 13 '16 at 17:07
1

If you have PowerShell 5.1, you have the equivalent of tzutil in PowerShell. For example, if you have Windows 10.

Examples:

See current time zone:

Get-TimeZone

See available time zones:

Get-TimeZone -ListAvailable

Set a time zone:

Set-TimeZone -Name "Georgian Standard Time"

Source: https://www.sysadmit.com/2019/08/cambiar-zona-horaria-Windows.html

Kame House
  • 11
  • 1
-2

Here is another answer to the initial question, related to Windows 7. This solution is completely based on Ionica Bizau's first contribution (see above). Essentially, I just added a step-by-step instruction for creating a batch file.

To create a batch file for setting time zones:

1) Create a text file in any text editor (PSPad, Notepad++, Notepad or whatever)

2) In the text file, write just one line of code. E.g. write

tzutil /s "GTB Standard Time"

which will set the time zone for Sofia, Bucharest, etc. Or use

tzutil /s "W. Europe Standard Time"

for places in the geographical longitudes of Amsterdam, Brussels, etc.

3) Save the file with a meaningful name such as "Set_TimeZone_W-Europe.bat". Make sure that the filetype suffix is ".bat". Save it at any place you like in your file system. You may choose your "Desktop" folder so to make the file available from your desktop screen.

4) That's it. Double-clicking the icon will trigger the (minimalistic) programme code to be executed, i.e. the system time will be set as desired.

Note: For my purposes, I made two such files, one for Western Europe, one for South East Europe, which are places I visit regularly.

If you need other time zones, look them up how they are named as follows:

a) Open the "Execute" window (cmd)

b) Type "tzutil /l" (without the quotation marks) and hit "return". This will display a list of available time zones.

  • 3
    -1 this answer just adds unnecessary "fluff" to the accepted one, plus answers a completely unasked question "how to make a batch file", not to mention the inconsistent use of "quote marks" -- then, after much extended detail on which text editor to use, how to name my file, where to save it AND how to execute it, at step 4 I am informed to simply: `Open the "Execute" window (cmd)` – RozzA Nov 27 '16 at 20:23
  • Thanks for commenting. This detailed instruction was written for people with less computing experience than you. (It tackles issues I myself had with the original answer.) Therefore it includes some parts that you may well find too verbose (e.g. mentioning how to create a text file), but I am sure there are people to whom such redundance will be helpful. - As for your remark about quotation marks: I checked it again now, and I still found their use quite consistent. Perhaps you are used to other rules from your environment? In my, this is typographcally good practice. – Christian Geiselmann Dec 04 '16 at 13:28