Wednesday, July 22, 2015

[CentOS] Command for setting the timezone

This sample is using CentOS7 .

Step1

Firstly, use this command to get the timezones list and press "enter" key
timedatectl list-timezones


Step2

Then you will get a list of timezone, remember the timezone string you need. For example, if i want to set the timezone to Hong Kong, I mark down the line 9 "Asia/HongKong" :
 
p.s. use the up and down arrows to view all time zones. Press CTRL-C if you wanted to exit the list of time zones.

 Step 3

Use the command "timedatectl set-timezone " and add the string you just mark down. There is sample command:

timedatectl set-timezone Asia/Hong_Kong



Step 4

After used the command at step3, you can use command "date" to check is the server's time same as what you expected :

date


No comments :

Post a Comment