This article is written assuming you have your operating system already updated to the latest versions available.
You have the choice of doing it with the graphical user interface (GUI), command prompt or with PowerShell. Lets just say you do not have access to the GUI, you should have direct access to the command line interface (CLI) or power shell to do the below commands.
If you do happen to have GUI access but want to feel cool using the CLI, make sure you run it as administrator to be able to run the commands.
In Command Prompt
date and fill in the prompt of
yy-mm-dd and hit enter. You then run
time and fill in the prompt of
This format also accepts military time (ie 24hours)
Easy, right? Good.
The fancy command prompt cousin that have much more to offer over bat scripts.
get-date to obtain the current time and date (like below picture) and run
set-date and follow the format of
Month date year hour:minutes:seconds AMorPM and hit enter.
General way would be to use
timedatectl. You could input the command of
timedatectl -h to obtain more information on each and every other combinations you could do with the command.
timedatectl status to know your current configurations.
sudo timedatectl set-time "hh:mm:ss" will get your servers time set quickly.
If you want your time and date to be properly assigned based on the zone you are physically located, use the command
sudo timedatectl set-timezone "Continent/City" . You will see a huge list of Continent/City combo’s using
sudo timedatectl list-timezones.
If we wanted to set our timezone to Canada, Quebec, Montreal, because of time zone rules and where the time servers are located, we’ll have to use America/Toronto.
If you are located somewhere else, I suggest to run the command
sudo timedatectl list-timezones | grep "Continent" and you’ll see a a list of each city located in your continent.
timedatectl is part of the Linux operating system, it is available on both Debian and Red Hat based OS.
Last option that I know of would be to use the command
sudo dpkg-reconfigure tzdata which will bring up a GUI (graphical user interface).
It’s very straightforward and takes only two or three steps to to go through.