Time synchronization is an important topic on large networks, especially on Linux computers. A lot of effort has been put into recent system updates to make it work by default, but it doesn’t mean that it does exactly what you want. I will answer all of your questions about time settings in this article.
By default, Ubuntu uses an Internet server to synchronize the time, and the time zone chosen during the installation. These settings can be checked in the system settings app, or edited via the command line.
I will start by explaining the default setup, then how you can fix the timezone and time synchronization via the interface, and finally, for those who need more, how to use NTP and timedatectl to customize the time synchronization the way you want.
How does Ubuntu sync time?
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
To find the current configuration on your system, open the Settings app and go to “Date & Time”. By default, “Automatic Date & Time” is enabled, and the time zone should be set to the one you chose during the system installation.
Time synchronization requires Internet access, so if you notice a delay between your Ubuntu system and other computers, it might be the reason. If you can, enable an Internet connection and wait a few minutes, Ubuntu should automatically sync it back to the correct date and time.
Overall, there is nothing to do if your system is properly configured (like in the screenshot) and connected to the Internet. But let’s see how to change these options when needed.
How to fix the time on Ubuntu?
Ubuntu date & time are automatically synchronized with a server on the Internet, but it’s possible to disable this or change the timezone in the system settings.
How to enable or disable automatic date and time?
- Open the system settings.
- Go to “Date & Time”
- Disable the “Automatic Date & Time” if you want to adjust the date & time manually.
- A new window appears, where you can configure it manually:
- Once done, close the window (there is no button, just close it).
That’s it, your date and time are now set the way you want.
Enabling the “Automatic Date & Time” option after that will instantly fix the date by using the Internet server.
How to change the time zone?
Just below the “Automatic Date & Time” option in the system settings, you can change the time zone currently used, or enable “Automatic Time zone” to let the system synchronize it for you.
The “Automatic Time Zone” option will use location services and your Internet IP address to find the correct time zone to use. This is particularly useful if you travel a lot. By enabling this, your system will always show the local time.
By default, the system uses the time zone you selected during the installation. Here is how to use another one:
- Click on the current time zone (In my previous screenshot, it’s “Paris, France”).
- The same map you viewed during installation will appear. You can click on the map to set the timezone you want to use. It will also select the biggest city near your click, so try to click exactly where you are (not the timezone only).
- Close the window to save your changes, the new timezone is immediately used on your system.
You now know how to change the basic settings related to date, time, and timezone on your Ubuntu system. But maybe you were looking for something more advanced, to change the server used for time synchronization, for example. If this is your case, don’t miss the next part!
Thanks to all my Patrons for supporting me, helping me to keep doing this and producing even more tutorials for everyone! Thank you to everyone supporting me there.
How to manually sync time on Ubuntu?
Grab your free PDF file with all the commands you need to know on Raspberry Pi!
Ubuntu has built a user-friendly interface to quickly change the date, time, and timezone. But advanced options are hidden, and command lines are required to change the synchronization server and other settings.
What is timedatectl on Ubuntu?
Timedatectl is the main tool used by Ubuntu to set up the date and time. It’s included by default in recent releases. Open a terminal and type this command to view the current configuration:
Basically, we can see the same settings as in the graphic interface. By default, Ubuntu has time synchronization enabled, by using the NTP service and your time zone.
Are you a bit lost in the Linux command line? Check this article first, for the most important commands to remember, and a free downloadable cheat sheet so you can have the commands at your fingertips.
Change the current configuration with timedatectl on Ubuntu
Timedatectl is not only used to view the current configuration, but you can also use the same command to make slight changes in it.
Here are some useful commands you can try:
- List the timezones available:
timedatectl list-timezones | grep Europe
- Change the current timezone:
sudo timedatectl set-timezone <timezone-name>
sudo timedatectl set-timezone America/New_York
sudo timedatectl set-timezone Europe/Paris
- Enable or disable time synchronization:
sudo timedatectl set-ntp false
sudo timedatectl set-ntp true
- Set the current time manually (time synchronization must be disabled first):
sudo timedatectl set-time 'Y:M:D HH:mm:ss'
sudo timedatectl set-time 'Y:M:D'
sudo timedatectl set-time 'HH:mm:ss'
These are the basic command options you need to know about timedatectl. This should be pretty handy on Ubuntu server, or via SSH, to do the same things you can in the graphic interface. But you can’t change the server used directly with these commands, you need to edit the configuration file.
Use another server for time synchronization on Ubuntu
Sale: 10% off today.
Get the eBook.
Do more with your Raspberry Pi, learn the useful concepts and take the shortcuts.
You miss half of the fun of using a Raspberry Pi if you don’t know anything about Python.
Ubuntu uses timedatectl and NTP by default for time synchronization. The only way to use another server is to edit the configuration file, located at /etc/systemd/timesyncd.conf.
Here is how to do this:
- Open a terminal, or connect to your Ubuntu system via SSH.
- Open the configuration file:
sudo nano /etc/systemd/timesyncd.conf
Enter your password if needed.
- The file looks like this:
Everything is commented by default, but you can see the default configuration.
Ubuntu date and time is synchronized with ntp.ubuntu.com.
- To use a custom server, add a new line, starting with FallbackNTP and the server you want to use. It can be a local IP address, a host name or a domain name. You can also set several severs, by separating them with spaces.
- Save and exit (CTRL+O, CTRL+X).
A reboot might be required to update the system configuration. The date & time will now be synchronized with your server, instead of the default one.
I hope this tutorial was useful, and answer all your question about time synchronization on Ubuntu. If this concept is still new for you, and you need more explanation on how it works, I highly recommend reading this other guide on how to sync time with a server. It’s for Raspberry Pi OS, but I explain the theory in more detail, and it applies the same way on Ubuntu.
Raspberry Pi Resources
Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.
Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.
If you just want to hang out with me and show your support, you can also join the Patreon community. I share behind-the-scenes content there and give you early access to my content. You’ll also get a shoutout when you join.
More details here.
Need help building something with Python?
Create, understand and improve any Python script for your Raspberry Pi.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.
You can also find all my recommendations for tools and hardware on this page.