Set Date, Time & Timezone on Ubuntu
In this article
To set the date, time, and timezone on Ubuntu, you can use either the graphical Settings app or the command line with timedatectl. The quickest method is to open Settings, go to Date & Time, and toggle automatic time off to set manually, or use sudo timedatectl set-timezone for precise control. This guide covers both approaches, including how to sync with NTP servers and fix common issues.
What You'll Need
- An Ubuntu system (desktop or server) with sudo access for command-line changes.
- For the graphical method, a desktop environment (GNOME, KDE, etc.) with the Settings app.
- An internet connection if you want to use automatic time synchronization (NTP).
Step-by-Step
Using the Graphical Settings (Desktop)
- Open the Settings app from the application menu (or click the system menu in the top-right corner and select the gear icon).
- Click on Date & Time in the left sidebar. Note: menu labels can vary slightly by Ubuntu version and desktop environment.
- To set the timezone automatically, ensure Automatic Time Zone is toggled on (it uses your network location). If you want to pick manually, toggle it off and click on the Time Zone field, then type or select your city from the map.
- To set the time manually, toggle Automatic Date & Time off. Then click on the Time field and use the up/down arrows or type the correct hour and minute.
- To set the date manually, click on the Date field and pick the correct day from the calendar.
- Close the Settings window. Your changes are saved immediately.
Using the Command Line (Terminal)
- Open a terminal (Ctrl+Alt+T).
- Check the current date, time, and timezone with:
timedatectl. This shows the local time, universal time, and the timezone in use. - List available timezones to find the one you need:
timedatectl list-timezones. Use the arrow keys to scroll, or pipe to grep to search, e.g.,timedatectl list-timezones | grep -i "new_york". - Set the timezone with:
sudo timedatectl set-timezone America/New_York(replace with your desired timezone). - To set the date and time manually, first disable automatic time synchronization:
sudo timedatectl set-ntp false. - Set the date and time using the format
YYYY-MM-DD HH:MM:SS, for example:sudo timedatectl set-time '2025-03-15 14:30:00'. - Re-enable automatic time sync if you want NTP back:
sudo timedatectl set-ntp true. - Verify your changes with
timedatectlagain.
Common Mistakes
- Using the wrong timezone name – timezone names are like
America/Chicago, not abbreviations likeCST. Always use the full IANA name fromlist-timezones. - Forgetting sudo –
timedatectl set-timezoneandset-timerequire root privileges. If you get a permission error, prefix withsudo. - Setting time while NTP is on – if automatic time sync is enabled, your manual time will be overwritten quickly. Turn off
set-ntpfirst. - Confusing local time with UTC –
timedatectlshows both. Make sure you set the correct one; the system clock is usually UTC internally. - Using 12-hour format in command line – the command line expects 24-hour time (e.g.,
14:30not2:30 PM).
Tips
- For most users, leaving Automatic Date & Time and Automatic Time Zone enabled is best—it keeps your clock accurate and adjusts for travel.
- If you need to set a timezone for a specific application (like a web server), you can also set the
TZenvironment variable in your shell profile, buttimedatectlis the system-wide method. - Use
timedatectl set-local-rtc 1if you dual-boot with Windows and want the hardware clock to use local time instead of UTC. This is a common fix for time drift between operating systems. - Check if your system uses
systemd-timesyncd(default) or NTP daemon. You can see the NTP service status withtimedatectl status.
Troubleshooting
Time keeps resetting after reboot
If your time resets to a wrong value after reboot, it could be a hardware clock (RTC) issue. Check with timedatectl – if “RTC in local TZ” is set incorrectly, fix it with sudo timedatectl set-local-rtc 0 (to use UTC) or 1 (to use local time) depending on your setup. Also ensure your system is connected to the internet to sync via NTP.
Automatic time sync is not working
First, check if NTP is enabled: timedatectl status – look for “NTP service: active”. If not, run sudo timedatectl set-ntp true. If it still fails, check your network connection and DNS. You can also manually force a sync with sudo systemctl restart systemd-timesyncd.
Timezone list is empty or missing
This is rare but can happen if the tzdata package is missing. Install it with sudo apt install tzdata and then try listing timezones again.
GUI settings are greyed out
If the time/date fields are greyed out in Settings, it usually means automatic time is still enabled. Toggle “Automatic Date & Time” off first. If that doesn't work, try the command line method as a fallback.
Frequently Asked Questions
How do I set the timezone to UTC?
Run sudo timedatectl set-timezone UTC. This is common for servers.
Can I set the time without sudo?
No, changing the system time or timezone requires root privileges. You can view the time without sudo, but changes need sudo.
What is the difference between local time and UTC?
UTC (Coordinated Universal Time) is the global standard time. Local time is UTC plus your timezone offset. The system clock is typically set to UTC, and your timezone determines what you see.
How do I sync my clock with an NTP server manually?
Use sudo timedatectl set-ntp true to enable automatic sync, or run sudo systemctl restart systemd-timesyncd to force a resync. For a one-time manual sync, you can use sudo ntpdate pool.ntp.org if the ntpdate package is installed.
Why is my time off by a few minutes even with automatic sync?
This can happen if your network firewall blocks NTP (port 123). Check your firewall rules. Also, the NTP sync interval is usually every few minutes, so a slight drift is normal.
Does changing the timezone affect my files' timestamps?
File timestamps are stored in UTC by default. Changing the timezone only changes how they are displayed, not the actual stored time. So your files are safe.