How To Set or Change the Timezone in Linux
On Linux, the system’s timezone is set during the install, but it can be easily changed at a later time.
Using the correct timezone is important for many systems related tasks and processes.
For example, the cron daemon uses the systems timezone for executing cron jobs, and the timestamps in the log files are based on the same systems timezone.
This tutorial explains how to set or change the timezone on AlmaLinux 8.x and 9.x
REQUIREMENTS
Before you start, you will need:
- SSH credentials and Logged In as Root
READ ME FIRST
This article is provided as a courtesy.
Installing, configuring, and troubleshooting third-party applications is outside the scope of basic support provided by Starburst Services.
Checking the Current Timezone
In modern Linux distros, you can use the timedatectl command to display and set the current systems time and timezone.
timedatectl
The output below shows that the system’s timezone is set to UTC:
Local time: Sun 2023-01-15 15:41:56 UTC
Universal time: Sun 2023-01-15 15:41:56 UTC
RTC time: Sun 2023-01-15 15:41:57
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes
Changing Timezone
Before changing the timezone, you’ll need to find out the long name for the timezone you want to use.
The timezone naming convention usually uses a (Region/City) format.
To list all available time zones, use the timedatectl command:
timedatectl list-timezones
Once you identify which time zone is accurate to your location:
timedatectl set-timezone your_time_zone
For example, to change the system’s timezone to America/Toronto:
timedatectl set-timezone America/Toronto
Run the timedatectl command to verify the changes:
timedatectl
Did you found this Knowledge Base Article useful?
Please considering thanking our SysOp Team.
KB Article Written: 2023 January 15