{"id":9384,"date":"2021-01-07T18:58:35","date_gmt":"2021-01-07T23:58:35","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=9384"},"modified":"2021-12-04T06:18:10","modified_gmt":"2021-12-04T06:18:10","slug":"change-time-zone-ubuntu-20-04","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/change-time-zone-ubuntu-20-04\/","title":{"rendered":"Change Time Zone on Ubuntu 20.04 | 18.04 With These Tips"},"content":{"rendered":"\n
Usually, you would set the correct time zone during the setup of your Ubuntu Server system. In case this did not happen or a mistake was made, there are some ways to change the time zone on Ubuntu systems using the command-line interface.<\/p>\n\n\n\n
Just to be on the same page, a time zone refers to a designated area of the globe that observes a uniform standard time. They are usually set using country boundaries or regional boundaries within a country, especially for larger ones.<\/p>\n\n\n\n
Run the following command:<\/p>\n\n\n\n
$ date<\/code><\/pre>\n\n\n\nExample Output:<\/p>\n\n\n\n
Thu Jan 7 21:26:59 UTC 2021<\/code><\/pre>\n\n\n\nThe above command shows that this system is running in the UTC timezone.<\/p>\n\n\n\n
The same can be achieved but with more detail by running:<\/p>\n\n\n\n
$ timedatectl<\/code><\/pre>\n\n\n\nThe expected output is:<\/p>\n\n\n\n
Local time: Thu 2021-01-07 21:29:05 UTC\n Universal time: Thu 2021-01-07 21:29:05 UTC\n RTC time: Thu 2021-01-07 21:29:06\n Time zone: Etc\/UTC (UTC, +0000)\n System clock synchronized: yes\nsystemd-timesyncd.service active: yes\n RTC in local TZ: no<\/code><\/pre>\n\n\n\nNow Let’s Change the Time Zone on Ubuntu 20.04<\/p>\n\n\n\n
Option 1 \u2013 Using timedatectl<\/h2>\n\n\n\n
You can find all the available time zones on your system. That way you can know the correct one to pick out.<\/p>\n\n\n\n
$ timedatectl list-timezones<\/code><\/pre>\n\n\n\nSearch for the preferred time zone name from the list then uses one of the following commands to set the new time zone on your system.<\/p>\n\n\n\n
$ sudo timedatectl set-timezone "America\/New_York"<\/code><\/pre>\n\n\n\nThe “America\/New_York<\/strong>” portion of the above command without quotes is what was retrieved from the list. You can get a comprehensive time zone list here<\/a>.<\/p>\n\n\n\nOption 2 \u2013 Using \/etc\/localtime<\/h2>\n\n\n\n
This is a more involving method and it’s a bit of a hack but nevertheless, it is an alternate option that you can use to change the time zone on Ubuntu.<\/p>\n\n\n\n
First, rename the \/etc\/localtime<\/em> file to keep it as a backup.<\/p>\n\n\n\n$ mv \/etc\/localtime \/etc\/localtime-backup<\/code><\/pre>\n\n\n\nChange the symbolic link of the file to the correct time zone configuration file. Find out more about how to create symbolic links in Linux from this post here<\/a>.<\/p>\n\n\n\n$ ln -s \/usr\/share\/zoneinfo\/America\/New_York \/etc\/localtime<\/code><\/pre>\n\n\n\nThat’s it. You can confirm the changes by running the timedatectl<\/strong><\/em> command again.<\/p>\n","protected":false},"excerpt":{"rendered":"Usually, you would set the correct time zone during the setup of your Ubuntu Server system. In case this did not happen or a mistake was made, there are some…<\/p>\n","protected":false},"author":1,"featured_media":9385,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,16,18],"tags":[183,193,354,573,598],"yoast_head":"\n
Change Time Zone on Ubuntu 20.04 | 18.04 With These Tips<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n\n\n\n\n\n\t\n\t\n\t\n