Usually, you would set the correct time zone during the setup of your Ubuntu A server is a computer application program that responds to requests for information from a client in a client/server relationship system. A typical example is a web server or pushing a web page to a web browser or a web server receiving email and transferring it to an email client. A server can also refer to the actual hardware designed... More system. In case this did not happen or a mistake was made, there are some ways to change the time zone on Ubuntu systems using the command-line In computing, an interface is a shared means by which two or more separate components of a computer system exchange information. The interface could be between the human and a computing device, two computers, computer hardware, software or peripheral devices. Examples include touch screens which allow information to be exchanged between a human and the devices, A software graphical interface,... More.
Just to be on the same page, a time zone refers to a designated area of the globe that observes a uniform standard time. They are usually set using country boundaries or regional boundaries within a country, especially for larger ones.
Confirm the Current Timezone
Run the following command:
Example Output in computer science or information technology is the response received from a computing device based on a given input. The target of the response could be the same device or another connected device. Some examples of output devices include monitors, printers, other networked computers, speakers, and storage devices among others.... More:
Thu Jan 7 21:26:59 UTC 2021
The above command shows that this system is running in UTC timezone.
The same can be achieved but with more detail by running:
With the expected Output in computer science or information technology is the response received from a computing device based on a given input. The target of the response could be the same device or another connected device. Some examples of output devices include monitors, printers, other networked computers, speakers, and storage devices among others.... More as:
Local time: Thu 2021-01-07 21:29:05 UTC Universal time: Thu 2021-01-07 21:29:05 UTC RTC time: Thu 2021-01-07 21:29:06 Time zone: Etc/UTC (UTC, +0000) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no
Now Let’s Change Time Zone on Ubuntu 20.04
Option 1 – Using timedatectl
You can find all the available time zones on your system. That way you can know the correct one to pick out.
$ timedatectl list-timezones
Search for the preferred time zone name from the list then uses one of the following commands to set the new time zone on your system.
$ sudo timedatectl set-timezone "America/New_York"
The “America/New_York” portion of the above command without quotes is what was retrieved from the list. You can get a comprehensive time zone list here.
Option 2 – Using /etc/localtime
This is a more involving method and it’s a A bit which is short for binary digit is the smallest unit of data in a computer or digital device. It can contain only one of two, either 0 or 1. Other representations such as true/false, yes/no, +/−, or on/off are possible with a single bit.... More of a hack but nevertheless, it is an alternate option that you can use to change the time zone on Ubuntu.
First rename the /etc/localtime file to keep as a backup.
$ mv /etc/localtime /etc/localtime-backup
Change the symbolic link of the file to the correct time zone configuration file. Find out more about how to create symbolic links in Linux from this post here.
$ ln -s /usr/share/zoneinfo/America/New_York /etc/localtime
That’s it. You can confirm the changes by running the timedatectl command again.