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

How to Set a Custom Time Zone on a VPS

This guide shows you how to change the time zone on your VPS, and what to do if the server does not let you.

Web Hosting2 min read7 steps

This guide needs root access. Root is the main admin login of your VPS.

What is a time zone?

The world is split into time zones. Each place has its own clock time. A VPS, or virtual private server, is your own slice of a bigger machine. It has its own clock setting. If the time zone is wrong, logs, emails and scheduled tasks show the wrong hour.

Check the current setting

  1. Log in to your VPS by SSH as root. SSH is a way to type commands on a server from your computer.
  2. Run this command.
    timedatectl
    It shows the date, time and time zone.

If this command is not found on an older system, use date instead.

Set a new time zone

  1. List zones that you can choose.
    timedatectl list-timezones
    This prints all names, like Asia/Kolkata or America/New_York. Press q to leave the list.
  2. Set your zone.
    timedatectl set-timezone Asia/Kolkata
    This changes the time zone. Replace the name with yours.
  3. Check again.
    date
    This should show the new time.

Older systems without timedatectl

  1. Link the zone file.
    ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
    This points the system clock to your zone.
  2. Run date to check.

If it says permission denied or does nothing

Some VPS types are containers. A container shares its core with others, so the host machine may block changes to the clock. The host admin has to allow it. On OpenVZ, for example, the host needs the sys_time capability turned on for your container. If you cannot change the zone, open a ticket at https://secure.hostvento.com/submitticket.php and ask Hostvento support.

Tip: Changing the time zone does not change the real moment in time. Only how it is shown changes. If the clock itself is wrong, ask support about time syncing.

After the change

  • Restart services that print times, such as web server and database.
  • Check scheduled tasks.

Quick recap

  • Check the time zone with timedatectl.
  • Change it with timedatectl set-timezone Zone/City.
  • Container VPS may need the host to allow it.
  • Restart services and check scheduled tasks.