Skip to Content

2 ways to Check timezone in Ubuntu

In this blog post, we will discuss two ways to check the timezone in Ubuntu. The first way is to use the date command, and the second way is to use the timedatectl command. Both commands are useful for checking the timezone on your system, and they both have their own advantages and disadvantages. Let’s take a closer look at each of these commands!

Check timezone with date command in Ubuntu

The best way to check timezone in Ubuntu is using date command. It will display the current date, time and timezone. To use the date command, all you need to do is type “date” into your terminal. The output of the date command will look something like this:Thu Apr 21 09:11:45 EDT 2022

The output of the date command is very straightforward and easy to understand.

If you only want to display the timezone, you can use date command + %Z or %z option.

date ‘+%Z’
EDT
date ‘+%z’
-0400

Check timezone with timedatectl command in Ubuntu

The timedatectl command is a more advanced command that allows you to both view and change the timezone on your system in Ubuntu. To use the timedatectl command, type “timedatectl” into your terminal.

timedatectl
Local time: Thu 2022-04-21 09:09:50 EDT
Universal time: Thu 2022-04-21 13:09:50 UTC
RTC time: Thu 2022-04-21 09:09:43
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes

As you can see, the output of the timedatectl command is much more detailed than the output of the date command. The timedatectl command not only displays the current date and time, but it also displays the time zone, whether or not NTP is enabled.

In addition, the timedatectl command allows you to change the timezone on your system. To do this, simply use the “timedatectl set-timezone” command followed by the desired timezone.

For example, to set the timezone to America/New_York, you would type the following into your terminal: timedatectl set-timezone America/New_York

If you are not sure which timezone you should use, you can run this command timedatectl list-timezones. You can also combine the timedatectl command with the grep command to filter the search using the name of a city.
timedatectl list-timezones | grep New_York