Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Change the Time Zone in Ubuntu

This guide shows you how to set the right time zone on an Ubuntu server so logs and scheduled jobs show the correct time. You need admin rights (sudo).

How-To Guides2 min read8 steps8 screenshots

What is a time zone?

The world is split into regions that each keep their own local time. These are time zones. Your server keeps one time zone setting. If it is wrong, your log files and scheduled tasks (called cron jobs) may run at times you do not expect. Sudo means "run this command as the admin".

Steps

  1. Log in to your server with SSH. SSH is a safe way to type commands on a server from far away.
  2. Check the current time and zone.
    timedatectl
    Look at the line named Time zone.
    Date & Time
  3. Find the name of your zone. Zone names look like Region/City. To search, type this.
    timedatectl list-timezones | grep Asia
    This lists all zones with the word Asia. Change the word to search other regions.
  4. Set your zone. Replace the example with your own.
    sudo timedatectl set-timezone Asia/Kolkata
    Local time
  5. Check again.
    timedatectl
    The time zone line should show your new choice.
    Ubuntu time

Another way: a menu

  1. Type sudo dpkg-reconfigure tzdata.
  2. Pick your area using the arrow keys and press Enter.
  3. Pick your city and press Enter.

Keep the clock exact

A right time zone is not enough if the clock itself drifts. Turn on network time, which sets the clock from the internet.

sudo timedatectl set-ntp true

This switches on automatic time syncing.

time and date
Asia Timezone

Good to know

  • Many server owners choose UTC. It is a world standard time with no daylight saving changes. It keeps logs simple.
  • Restart long-running programs after the change. Some read the zone only when they start.
  • Websites such as WordPress have their own time zone setting. It is separate from the server.
Tip: This guide works on Ubuntu 16.04 and newer. Older systems used other commands, so use these steps on a current version.

Quick recap

  • Check with timedatectl.
  • Set with sudo timedatectl set-timezone Region/City.
    Ubuntu timedate
  • Turn on network time with set-ntp true.
    Switch Off timezone
    Change location zone