change timezone in linux code example

Example 1: linux set date timezone

# To view timezone
timedatectl

# list all available timezones
timedatectl list-timezones

# update timezone
sudo timedatectl set-timezone your_time_zone

Example 2: linux check timezone

$ date +"%Z %z"

Example 3: set timezone in debian terminal

sudo timedatectl set-timezone <your_time_zone>

Example 4: how to change timezone in linux

sudo timedatectl set-timezone America/New_York

Example 5: linux how to display current time with timezone

timedatectl

Output
------------
                      Local time: Tue 2019-12-03 16:30:44 UTC
                  Universal time: Tue 2019-12-03 16:30:44 UTC
                        RTC time: Tue 2019-12-03 16:30:44
                       Time zone: Etc/UTC (UTC, +0000)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Tags:

C Example