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.

7
  • 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. Jul 22, 2016 at 10:20
  • I would recommend turning on ntp. Jul 22, 2016 at 10:22
  • You should have a look here;) unix.stackexchange.com/questions/110522/…
    – glmrenard
    Jul 22, 2016 at 11:15
  • @richard, no, it's +8
    – Johshi
    Jul 22, 2016 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. Jul 22, 2016 at 16:15

1 Answer 1

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.

3
  • 1
    Better to use a symlink, than to copy. Jul 24, 2016 at 12:58
  • You are right @richard. I updated the commands. Thanks for your comment.
    – gongomgra
    Jul 24, 2016 at 14:07
  • Better to always specify -T or -t option with ln, cp, mv as the simple TARGET LINK_NAME (1st form in man), and TARGET... DIRECTORY (3rd form in man) look the same, and depend only on if the 2nd argument is a directory. Jul 24, 2016 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .