Ubuntu Time Zone

6 months ago by giacholari

As a programmer, when working with virtual machines, you often encounter bizarre things. One of which is the time zone issue. My host and virtual machine were not synchronised properly, in that the wrong time was displayed within the virtual machine (which is running https://ubuntu.com/). To fix this issue, first check the time zone already set in your virtual machine with either this timedatectl or that cat /etc/timezone command. Next, list all the available time zones, like so timedatectl list-timezones. Once you have found the one you were looking for (let us assume that is Europe/London), then to apply it, run the following command sudo timedatectl set-timezone Europe/London. Finally, to ensure all is OK, invoke this command timedatectl. It should now indicate the new time zone. Great job. Note, that this change has nothing to do with your application (website, app etc.) time zone. You can still have a different one set for your application - it is customisable. For reference, see this article https://linuxize.com/post/how-to-set-or-change-timezone-on-ubuntu-20-04/.