How to Set and Manage Time Zones on Ubuntu: Complete Guide for Beginners and Servers

目次

Introduction

Have you ever felt that the time is incorrect on Ubuntu, that log timestamps do not match, or that cron jobs run at unexpected times?
In many cases, the root cause is the time zone configuration.

Ubuntu is widely used not only for desktop environments but also for VPS, cloud servers, and development systems. As a result, it is not uncommon for systems to remain configured with UTC (Coordinated Universal Time) instead of JST (Japan Standard Time) when left at default settings.

In this article, we will explain step by step, in a beginner-friendly way:

  • The basic concept of time zones
  • How to check the current configuration
  • Safe procedures to change time zones

Let’s start by understanding what a time zone actually is.

1. What Is a Time Zone in Ubuntu?

1.1 Relationship Between Time Zones and System Time

A time zone is a standard that divides the world into multiple time regions.
On Linux systems such as Ubuntu, the displayed date and time are determined by combining the system’s internal clock with the configured time zone.

There are two important points to understand:

  • The system maintains a base reference time
  • The time zone determines how that time is displayed for a specific region

In other words, the same time data can appear differently depending on the configured time zone.

1.2 Difference Between UTC and JST (Japan Standard Time)

In many Ubuntu default installations and server environments, the time zone is set to UTC.

  • UTC (Coordinated Universal Time): the global reference time standard
  • JST (Japan Standard Time): UTC plus 9 hours (UTC+9)

For example, when the time is 00:00 in UTC, it is 09:00 in Japan.
If this difference is not properly understood, it can lead to confusion such as:

  • Log timestamps appearing 9 hours off
  • cron jobs running at unexpected times
  • Application timestamps looking incorrect

1.3 Problems Caused by Missing or Incorrect Time Zone Settings

If the time zone is not configured correctly, the impact goes beyond cosmetic issues and can cause operational problems.

Common examples include:

  • Server logs becoming difficult to analyze due to incorrect timestamps
  • Backup jobs and scheduled tasks running at the wrong time
  • Database records storing unexpected timestamps

In environments where multiple people are involved in development or operations, time zone mismatches can easily cause misunderstandings, making early clarification essential.

2. How to Check the Current Time Zone

Before changing the time zone on Ubuntu, it is important to verify which time zone is currently configured.
Ubuntu provides several officially recommended methods to check this.

Here, we focus on safe and beginner-friendly approaches.

2.1 Checking with timedatectl (Recommended)

Modern Ubuntu systems include a standard command called timedatectl for managing and checking time and time zone settings.

Open a terminal and run the following command:

timedatectl

You will see output similar to the following:

  • Local time
  • Universal time
  • Time zone
  • System clock synchronized

The most important line is Time zone.

Example:

Time zone: Asia/Tokyo (JST, +0900)

This indicates that Ubuntu is operating in Japan Standard Time.

If you see something like the following, the system is using UTC:

Time zone: Etc/UTC (UTC, +0000)

2.2 How to Interpret the Output

The output of timedatectl displays multiple time values, which can be confusing at first.

  • Local time → Time adjusted to the configured time zone
  • Universal time → UTC-based time
  • RTC time → Hardware clock time (meaning varies by system)

For beginners, it is sufficient to focus on the following two points:
👉 Check whether the Time zone and Local time are correct

2.3 Checking via the /etc/timezone File

Ubuntu also stores the configured time zone in a file.

You can check it using the following command:

cat /etc/timezone

Example output:

Asia/Tokyo

This method is simple but should be used for confirmation only.
Although direct editing is possible, it is no longer recommended.

This is because:

  • It may cause inconsistencies with timedatectl
  • System configuration may become incomplete

2.4 Can You Check via the GUI?

If you are using Ubuntu Desktop, you can also check the time zone from the settings menu:

  • Settings
  • Date & Time
  • Time Zone

However, GUI access is not available on servers or SSH-only environments, so learning to use timedatectl is strongly recommended.

3. How to Change the Time Zone on Ubuntu (CLI)

Once you have confirmed the current time zone, the next step is to change it.
Ubuntu provides an officially recommended and safe method, so there is no need to manually edit configuration files.

Here, we focus on command-line (CLI) based procedures.

3.1 Basic Method Using timedatectl set-timezone

The most reliable way to change the time zone on Ubuntu is to use the timedatectl set-timezone command.

Basic syntax:

sudo timedatectl set-timezone TIME_ZONE

For example, to set Japan Standard Time (JST), run:

sudo timedatectl set-timezone Asia/Tokyo

No message is displayed after execution, but the command completes successfully.

3.2 Verifying the Change

To confirm that the change has been applied, run timedatectl again:

timedatectl

If you see the following, the change was successful:

Time zone: Asia/Tokyo (JST, +0900)

The change takes effect immediately and does not require a reboot.

3.3 Listing Available Time Zones

If you are unsure of the correct time zone name, you can list all available options:

timedatectl list-timezones

Since the list is extensive, it is practical to filter by region:

timedatectl list-timezones | grep Asia

This allows you to confirm that Asia/Tokyo is available.

3.4 Why Administrator Privileges (sudo) Are Required

Changing the time zone affects the entire system.
For this reason, administrator privileges (sudo) are required.

If you encounter an error like the following:

Failed to set time zone: Access denied

Make sure you did not forget to use sudo.

3.5 Deprecated Methods (Not Recommended)

You may still find older articles online that suggest:

  • Editing /etc/timezone directly
  • Manually overwriting /etc/localtime

These methods are not recommended on modern Ubuntu systems.
Using timedatectl ensures all related settings are managed consistently.

4. Changing the Time Zone via Ubuntu Desktop (GUI)

If you are using Ubuntu Desktop, you can also change the time zone via the graphical settings interface.
This may be easier for users unfamiliar with command-line operations.

However, there are important considerations when using the GUI.

4.1 Steps to Change the Time Zone from Settings

The general procedure in the default Ubuntu desktop environment is as follows:

  1. Click the system menu in the top-right corner
  2. Open Settings
  3. Select Date & Time
  4. Check or change the Time Zone

If a map is displayed, clicking near Japan will automatically select Asia/Tokyo (JST).

4.2 Automatic vs Manual Configuration

In the GUI, automatic time zone detection may be enabled.

  • Automatic: Determines the time zone based on location services
  • Manual: Explicitly specified by the user

This can be convenient for laptops, but for desktops or servers, unintended changes may occur.

For stable operation:
👉 Disable automatic detection and manually set Asia/Tokyo.

4.3 When GUI Changes Do Not Apply

In some cases, the time may still appear incorrect after changing settings via the GUI.

Common causes include:

  • NTP-based time synchronization adjusting the clock
  • Inconsistencies between GUI and CLI settings
  • Applications using their own time configurations

In such cases, open a terminal and run:

timedatectl

Even when configured via the GUI, timedatectl is used internally, making it the most reliable way to confirm the final state.

4.4 GUI vs CLI: Which Should You Use?

Recommended usage depends on your environment:

  • Desktop use / beginners → GUI is sufficient
  • Servers / development environments / SSH access → CLI (timedatectl)

For troubleshooting, CLI provides more detailed information and makes root cause analysis easier.

5. Important Considerations for Server Environments (VPS and Cloud)

When Ubuntu is used in server environments, the approach differs slightly from desktop usage.
In VPS and cloud environments, systems are often intentionally operated with UTC, so it is important to understand the reasons and precautions.

5.1 Why Servers Are Often Set to UTC by Default

Many VPS and cloud providers configure Ubuntu with the UTC time zone by default.
This is not arbitrary but based on operational efficiency.

Main reasons include:

  • Easier time alignment across global regions and users
  • No impact from daylight saving time (DST)
  • Reduced confusion during log analysis and incident response

Especially in multi-region systems, using UTC as a common reference helps prevent operational issues.

5.2 When Changing to JST Is Acceptable

In the following environments, changing to JST is generally safe:

  • Personal servers used only within Japan
  • Small-scale business systems
  • Learning or testing environments

In these cases, logs and dashboards become easier to understand, improving operational clarity.

However, extra caution is required when changing an already running system.

5.3 Precautions When Changing Time Zones on a Running Server

Changing the time zone on an active server may cause the following effects:

  • Log timestamps change from that point forward
  • Scheduled jobs (cron) run at different times
  • Applications that depend on timestamps may behave differently

Recommended precautions:

  • Leave notes in logs before and after the change
  • Review cron schedules carefully
  • Assess the scope of impact before applying changes

5.4 Relationship with NTP (Time Synchronization)

Ubuntu typically synchronizes system time using NTP (Network Time Protocol).

Changing the time zone does not conflict with NTP itself, but if you observe:

  • The system time drifting
  • Unexpected automatic corrections

Check the synchronization status using:

timedatectl

If the output shows:
System clock synchronized: yes
then time synchronization is working correctly.

6. What to Verify After Changing the Time Zone

After changing the time zone on Ubuntu, the process does not end there.
To avoid operational issues, there are critical points that must be verified.

6.1 Confirm the Setting Persists After Reboot

First, verify that the time zone remains unchanged after a reboot.

When changed using timedatectl, the setting is normally preserved.
After rebooting, confirm with:

timedatectl

If you see Time zone: Asia/Tokyo, the configuration is intact.

6.2 Check cron Job Execution Times

cron jobs operate based on the system’s local time.
As a result, changing the time zone may shift execution times.

Verify the following:

  • Jobs run at the intended times
  • Schedules were not based on UTC assumptions
  • Execution logs match expected timestamps

For server operations, always review cron settings after changing the time zone.

6.3 Log File Timestamp Changes

System and application logs will also reflect the time zone change.

Common sources of confusion include:

  • Older logs in UTC, newer logs in JST
  • Apparent time jumps in log sequences

This behavior is normal.
It is important to keep track of when the time zone change was applied.

6.4 Considerations for Docker and Virtualized Environments

When using Docker containers or virtual machines, time zones may be managed independently from the host OS.

Common scenarios include:

  • The host uses JST while containers remain on UTC
  • Only application logs show incorrect times

In such cases, you must check and configure the time zone inside the container or virtual environment as well.

7. Common Issues and Troubleshooting

Even when following correct procedures, issues may still arise after changing time zone settings.
Here are common problems and how to approach them.

7.1 Time Is Still Incorrect After Changing the Time Zone

If the time zone is correct but the time itself is wrong, the display will still be incorrect.

Check the following:

timedatectl
  • Is Time zone set correctly?
  • Is System clock synchronized set to yes?

If synchronization is no, time synchronization is not functioning properly.
Check network connectivity and NTP status.

7.2 Time Reverts Automatically Due to NTP

If the time appears to revert after manual adjustments, NTP may be correcting it.

Note that:

  • NTP maintains accurate system time
  • Time zones only affect how time is displayed

When using timedatectl set-timezone, NTP will not override the time zone.

If concerned, verify settings with:

timedatectl status

7.3 Only Specific Applications Show Incorrect Time

If Ubuntu system time is correct but certain applications show incorrect timestamps, common causes include:

  • The application assumes UTC internally
  • Application-specific time zone settings
  • Execution within Docker or virtual environments

In these cases, review the application configuration and design, not just the OS settings.

Many web applications and databases intentionally store timestamps in UTC and convert them for display.

7.4 Configuration Changes Do Not Apply or Errors Occur

In rare cases, you may encounter:

  • Insufficient permissions (missing sudo)
  • Older Ubuntu versions without timedatectl
  • systemd-related issues

Basic troubleshooting steps:

  • Confirm sudo usage
  • Check the Ubuntu version
  • Log out or reboot

If issues persist, environment-specific factors may be involved.

8. Best Practices for Time Zone Management on Ubuntu

You now understand how time zones work and how to configure them on Ubuntu.
Here are best practices to minimize confusion in real-world operations.

8.1 Use UTC for Servers, Convert for Display

A common operational model is:

  • OS and servers: operate in UTC
  • Applications and UI: convert to local time zones

Advantages:

  • Consistent global time reference
  • No DST-related complications
  • Easier management across regions

For systems expected to scale, designing around UTC from the beginning reduces future issues.

8.2 JST Is Fine for Personal or Learning Environments

For the following cases, JST-based operation is perfectly acceptable:

  • Personal computers
  • Learning or practice servers
  • Small domestic environments

Prioritize clarity and ease of understanding.

The key point is:
👉 Always be aware of which time standard your system uses.

8.3 Standardize Rules Across Teams and Environments

Many issues arise when time standards differ between people or environments.

Clearly define and share rules such as:

  • Servers use UTC
  • Logs use UTC
  • Display times are converted

Clear rules help prevent long-term operational confusion.

9. FAQ

9.1 What Is the Safest Way to Change the Time Zone to JST on Ubuntu?

Using timedatectl set-timezone Asia/Tokyo is currently the safest and recommended approach.
Manual editing of configuration files is unnecessary.

9.2 Does Changing the Time Zone Affect the System?

It affects time display, cron execution timing, and log timestamps.
However, it does not damage the system itself.
Always assess the impact before changing settings on production servers.

9.3 Should Ubuntu Servers Remain on UTC?

For servers and team-based development, operating in UTC offers significant advantages.
For personal or domestic use, JST is also acceptable.

9.4 Will the Time Zone Revert After Reboot?

When configured using timedatectl, the setting persists across reboots.
If it reverts, automatic settings or external tools may be affecting it.

9.5 Does Changing the Ubuntu Time Zone Fix Docker Containers?

Docker containers may manage time zones independently from the host OS.
Even if Ubuntu is configured correctly, container-level settings may still need adjustment.

10. Summary

Time zone configuration in Ubuntu may seem minor, but it directly affects logs, scheduled tasks, and operational stability.

Key takeaways:

  • Check the current setting with timedatectl
  • Change time zones using timedatectl set-timezone
  • Consider UTC operation for servers
  • Always review cron jobs and logs after changes

By understanding time zones and choosing the configuration that fits your use case, you can operate Ubuntu systems with greater confidence and reliability.

侍エンジニア塾