Set time and change timezone in Ubuntu 18.04 using command-line

The “timedatectl” command allows you to set/change/manage time in your Ubuntu 18.04 server using command line. This article explains how to change timezone in Ubuntu 18.04 LTS server in command line. Once you set your timezone the server will automatically sync with NTP servers to get correct time instantly.  You don’t need to set time manually. But you must have internet connection to reach NTP server. 

Check timezone in Ubuntu – command line

[email protected]:~$ timedatectl

Here i pasted the output below. you can see the time zone is +4:00 (Asia/Dubai) time zone)

Local time: Fri 2019-04-12 18:31:23 +04
Universal time: Fri 2019-04-12 14:31:23 UTC
RTC time: Fri 2019-04-12 14:31:23
Time zone: Asia/Dubai (+04, +0400)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no

How to choose your timezone code

[email protected]:~$ timedatectl list-timezones
above command will list all the timezone names. Find yours and go to next step.

Change timezone in Ubuntu 18.04 command line

[email protected]:~$ timedatectl set-timezone Asia/Dubai

For example, The above command will set tour time zone to Asia/Dubai (+4:00). If you want to set to indian time, set to Asia/Kolkata ( +5:00), etc 

how to change timezone in ubuntu 18.04 command line

Leave a Reply

Are you a human being ? *