Setting the time and date of a Windows computer isn’t rocket science, mostly because Microsoft has made it pretty easy to just open the Control Panel or Settings app (in Windows 10) and configure the few options in this regard.
But at the same time, syncing the Windows time with a time server, adjusting the time and date, and creating scripts that would automatically sync the time every time the computer boots isn’t the kind of thing that everyone can do.
And fortunately, it’s something that is actually possible in Windows, and it all comes down to a bunch of commands that pretty much anyone can remember and use just like an IT professional.
First and foremost, let’s open an elevated Command Prompt windows – this is Command Prompt with administrator privileges. In Windows 10, type cmd.exe in the Start menu, right-click the result and click the option that reads Run as administrator.
Before anything, if you want to adjust the time from Command Prompt, the command you need to use is pretty simple:
You’ll notice the active window shows you the current time of your system and prompts you to set up the new time based on the same format. Enter the time and hit Enter.
The same thing works for setting up the date of your system as well, and in this case, the command is the following:
In Windows, the time can be synced automatically with a time server, and this ensures that the time of your computer is always accurate. While you can do this from settings, Command Prompt also allows you to sync the time not only with the pre-defined servers, but also with a server of your own.
In this case, the command is the following, but keep in mind that you must change the timeserver parameter with the address of your time server:
w32tm /config /update /manualpeerlist:timeserver
If you need to resync the Windows time, you can use the following command – resyncing allows the Windows time to check for updates with the configured server, so it automatically retries the correct time:
If you want to create a script that runs at boot and automatically syncs the Windows time with the selected server, you can combine the aforementioned commands in a BAT file with the following commands:
net stop w32time
w32tm /config /syncfromflags:manual /manualpeerlist:timeserver
net start w32time
w32tm /config /update
w32tm /resync /rediscover
To create a BAT file, create a new text document on the desktop, copy the aforementioned script inside it and then change the extension of the file from TXT to BAT.
If you’re running Windows 10 and want to adjust time without actually typing all these commands, the Settings app is exactly what you need and all the aforementioned options are bundled here into a much more straightforward menu.
All the time and date settings are available at the following location in Windows 10:
Settings > Time & Language > Date & time
You can configure the time zone and let Windows 10 set the time automatically, in which case the operating system would sync with the pre-defined time servers to retrieve the time and sync it with your computer.
Windows 10 also allows you to have the time zone configured automatically, but for this feature, the OS needs the location service to be turned on. Other options include auto-adjusting for daylight saving time, as well as time and date formats if you want the info displayed across the operating system to be shown in a different format.
All the info is also available on the other Windows versions, only that they are bundled into the classic Control Panel, which in Windows 10 is being removed in the favor of Settings.