2

I've changed my time-zone to be 1 hours behind. I've called

timedatectl set-timezone Asia/Bangkok

Although the timezone is changed, the time is still the same as in my old time-zone, that is, this time is wrong, it's 1 hours ahead of the real time:

$ timedatectl status
      Local time: Fri 2016-07-22 12:28:30 ICT
  Universal time: Fri 2016-07-22 05:28:30 UTC
        RTC time: Fri 2016-07-22 05:28:29
       Time zone: Asia/Bangkok (ICT, +0700)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no

Even after reboot.

Johshi
  • 463
  • 2
  • 5
  • 14
  • It all looks good, you asked for Bangkok time and got it. It says that Bangkok is UTC+7, this is also what I read on the web. So check that your clock is set correctly. Are you confusing UTC/GMT with London (UK) time? UK is presently one hour ahead of GMT, because of daylight wast of time. – ctrl-alt-delor Jul 22 '16 at 10:20
  • I would recommend turning on ntp. – ctrl-alt-delor Jul 22 '16 at 10:22
  • You should have a look here;) http://unix.stackexchange.com/questions/110522/timezone-setting-in-linux – glmrenard Jul 22 '16 at 11:15
  • @richard, no, it's +8 – Johshi Jul 22 '16 at 15:26
  • Why do you think that bangkok is +8? Every where I look on the internet has bangkok at +7. They say it is 23:16 there now. In is 17:16 here in UK (London), 16:16 UTC. – ctrl-alt-delor Jul 22 '16 at 16:15
  • @richard, I don't. I'm saying that on my computer the time is +8, although the time-zone is Bangkok. Have you read my question at all? – Johshi Jul 23 '16 at 06:05
  • Sorry my mistake. Can you show the output of date; timedatectl status – ctrl-alt-delor Jul 23 '16 at 14:55

1 Answers1

2

One way to determine the local time zone is to run the following script:

tzselect

After answering a few questions about the location, the script will output the name of the time zone (e.g., Asia/Bangkok).

Then create the /etc/localtime file by running:

sudo ln -sT /usr/share/zoneinfo/<xyz> /etc/localtime

Replace with the name of the time zone selected (e.g., Asia/Bangkok). In your specific case:

sudo ln -sT /usr/share/zoneinfo/Asia/Bangkok /etc/localtime

It will change the timezone in your system wide (I mean for all users).

You can check that the new timezone is properly set automatically by running the command date. For instance, I tested it right now and it returns

Sun Jul 24 13:26:51 ITC 2016

Also, as suggested from the tzselect script output, you can make this change permanent for your user only by setting and exporting the TZ environment variable. To do that, you have to append the line TZ='Asia/Bangkok'; export TZ to the end of the .profile file in your home directory. You can run the command below to do that:

echo "TZ='Asia/Bangkok'; export TZ" >> $HOME/.profile

After that, you will need to log out of your current session and log back in for changes to take effect.