Skip to content
Search

Time zone

lastmod 2025-06-12created 2020-08-2111 edits

A time zone is a dividing line of time devised to artificially adjust for the time difference between regions relative to the Royal Observatory, Greenwich in the UK (prime meridian, longitude 0°), in other words, the difference in day and night between regions caused by the Earth's rotation. Time zones are expressed as a relative offset from Coordinated Universal Time (UTC).

Categories

KST (Korea Standard Time)

KST (Korea Standard Time) equals UTC plus 9 hours.

KST = UTC + 9 hours

Debian: noninteractive tzdata install

#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime
apt-get install -y tzdata
dpkg-reconfigure --frontend noninteractive tzdata

How to change the time zone on Linux

The command to check the date and time is:

date

Alternatively, the command below shows more detailed time information.

timedatectl

Javascript Time zone

See JavaScript:TimeZone for details.

How to change the time

Changing with the timedatectl command

The timedatectl command used to check the time can also change the time zone easily.

The following command shows the Korean time zone.

timedatectl list-timezones | grep Seoul

Set the Korean time zone to Asia/Seoul.

sudo timedatectl set-timezone Asia/Seoul

After running the command, check the time again to see the changed time zone.

timedatectl

Changing /etc/localtime

The current time zone setting can be found by checking the /etc/localtime symbolic link.

ls -l /etc/localtime

If it is set to UTC, it points to /usr/share/zoneinfo/Etc/UTC.

Running timedatectl above changes this symbolic link.

lrwxrwxrwx 1 root root 27 Jul 30 03:46 /etc/localtime -> /usr/share/zoneinfo/Etc/UTC

To change to Korea Standard Time (KST), delete /etc/localtime and create it again.

First, delete the current symbolic link.

sudo rm -rf /etc/localtime

Then recreate the symbolic link pointing to Korea Standard Time (/usr/share/zoneinfo/Asia/Seoul).

sudo ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime

The time zones for each region can be found under /usr/share/zoneinfo/.

Environment variables

Use TZ:

TZ=Asia/Seoul

Can be checked with the date command as follows:

TZ=Asia/Seoul date +%Y%M%d-%H:%m:%S

See also

Favorite site

author Zer0 sitemap