Setting up proper date and time

Setting up the proper date and time is essential if you don't want to slow down or even halt your service or application deployment on a new server or desktop computer.

By default servers and computers should immediately be using the internet's network time protocol (NTP) to have the correct time zone, date and time set but sometimes, you'll need to set it yourself.

On Linux

Using the command timedatectl is what we'll need to use in order to set our time zone which will also set the correct time and date at the same time. We could see a list of all the time zone's using:

timedatectl list-timezones

We could also include the grep command to specifically find our string. For example if we wanted to find all regions located within a continent.

timedatectl list-timezones | grep America

timedatectl list-timezones | grep Europe

timedatectl list-timezones | grep Africa

From there we may set the time after finding our timezone string from the above commands. In my case because the server is located in Montreal, I'll need to use America/Toronto as its the closest region to Montreal and also shares the same time.

timedatectl set-timezone 'America/Toronto'

On Windows

You could easily configure this by accessing date and time settings or right clicking the time found on your taskbar pane then Adjust date/time, the very first option found at the top in the list. Sometimes however you may being using a server that doesn't have administrator rights or maybe group policy issues might be blocking you. Until resolving the issue (which I would suggest figuring out why first!) you could actually manipulate your time, date and timezone using the tzutil command.

Adding /g parameter will give us our current timezone setting.

Adding /l lists each and every timezone available. You will copy the bare string name without the UTC.

Say our server is located in Taipei Taiwan, we would use the following to apply the new date and time.

You can use tzutil /g to check if it was correctly applied, though you should an immediate change in the Taskbar pane.

Congratulations! You’ve successfully switched your time zone, date and time!

Add a Comment

Your email address will not be published. Required fields are marked *