If you live in a different timezone than the one configured on the server, you can change it for your account via SSH.


Step 1 – Select Your Timezone

Log in to your service via SSH and run the following command:

tzselect

Follow the prompts to select your continent, country and timezone.

When the process is complete, you will see output similar to the example below:

You can make this change permanent for yourself by appending the line
        TZ='Europe/Amsterdam'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Europe/Amsterdam

Step 2 – Make the Timezone Permanent

The timezone selected with tzselect only applies to the current SSH session.

To make it permanent, use the following command:

echo "TZ='Europe/Amsterdam'; export TZ" >> ~/.profile

Replace:

TZ='Europe/Amsterdam'; export TZ

with the value returned by the tzselect command.


Step 3 – Apply the Changes

Reload your profile to apply the changes to the current SSH session:

source ~/.profile

Step 4 – Verify Your Timezone

To verify that the new timezone has been applied, run:

date

Step 5 – Restart Your Applications

Restart all running applications so they begin using the new timezone.


Notes

  • The timezone selected with tzselect only affects the current SSH session until it is added to ~/.profile.
  • Use the exact TZ=... value returned by tzselect when updating your ~/.profile.
  • Restart your applications after changing the timezone to ensure they use the updated settings.
Was this answer helpful? 144 Users Found This Useful (282 Votes)