Consistent date and time formats across Linux hosts reduce confusion in logs, monitoring dashboards, and automated reports. Aligning regional settings with organizational standards keeps timestamps readable across teams and simplifies correlation between different systems.

System-wide format choices are driven by the locale environment variables such as LANG and LC_TIME, along with the configured system timezone. Tools like locale, locale-gen, and update-locale control which locales are generated and which values are applied by default, while timedatectl manages the underlying clock and timezone on systemd-based distributions.

On most Ubuntu and Debian systems, adjusting these values from the terminal provides predictable, scriptable changes that apply to all users. Root access is required, and changing timezone or locale on production machines can alter how new log entries are written compared to historical data, so verification after each step is essential and rollbacks should be planned before modifying running services.

Steps to adjust system date and time formats in Linux:

  1. Open a terminal with a user that can run administrative commands.
    $ whoami
    user
    $ groups
    user sudo
  2. Display current locale category values.
    $ locale
    LANG=en_US.UTF-8
    LANGUAGE=
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_US.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=

    LC_TIME controls how dates and times are formatted while other LC_* variables affect numbers, messages, and related categories.

  3. List all generated locales available on the system.
    $ locale -a
    C
    C.utf8
    en_GB.utf8
    en_US.utf8
    POSIX
  4. Generate a missing locale that matches the desired regional date and time format.
    $ sudo locale-gen en_GB.UTF-8
    Generating locales (this might take a while)...
      en_GB.UTF-8... done
    Generation complete.
  5. Set the system default locale and override the date and time category if needed.
    $ sudo update-locale LANG=en_US.UTF-8 LC_TIME=en_GB.UTF-8

    update-locale writes settings such as LANG and LC_TIME to /etc/default/locale so they apply automatically to future logins.

  6. Verify the updated locale values in a new login shell.
    $ locale
    LANG=en_US.UTF-8
    LANGUAGE=
    LC_CTYPE="en_US.UTF-8"
    LC_NUMERIC="en_US.UTF-8"
    LC_TIME="en_GB.UTF-8"
    LC_COLLATE="en_US.UTF-8"
    LC_MONETARY="en_US.UTF-8"
    LC_MESSAGES="en_US.UTF-8"
    LC_PAPER="en_US.UTF-8"
    LC_NAME="en_US.UTF-8"
    LC_ADDRESS="en_US.UTF-8"
    LC_TELEPHONE="en_US.UTF-8"
    LC_MEASUREMENT="en_US.UTF-8"
    LC_IDENTIFICATION="en_US.UTF-8"
    LC_ALL=
  7. Inspect the current clock and timezone configuration before changing it.
    $ timedatectl status
                   Local time: Mon 2025-03-03 14:00:00 UTC
               Universal time: Mon 2025-03-03 14:00:00 UTC
                     RTC time: Mon 2025-03-03 14:00:00
                    Time zone: Etc/UTC (UTC, +0000)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
  8. List available time zones filtered for a specific region.
    $ timedatectl list-timezones | grep -i europe
    Europe/Amsterdam
    Europe/Berlin
    Europe/London
    Europe/Paris
    ##### snipped #####

    timedatectl list-timezones returns all valid identifiers in the form Region/City that can be passed back to timedatectl set-timezone.

  9. Set the system timezone to the chosen entry.
    $ sudo timedatectl set-timezone Europe/Berlin

    Changing the system timezone alters how new log entries, scheduled jobs, and monitoring data are timestamped, which can complicate comparison with existing records.

  10. Confirm that the new timezone is active and the local time is correct.
    $ timedatectl status
                   Local time: Mon 2025-03-03 15:00:00 CET
               Universal time: Mon 2025-03-03 14:00:00 UTC
                     RTC time: Mon 2025-03-03 14:00:00
                    Time zone: Europe/Berlin (CET, +0100)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: no
  11. Display the current date using the updated locale and timezone.
    $ date
    Mon Mar  3 15:00:00 CET 2025
Discuss the article:

Comment anonymously. Login not required.