The default time zone for an ECS is the one you selected when creating the image that was used to create the ECS. This section describes how to change the time zone for an ECS to the local one or to another time zone in your network.
After you log in to your ECS, if you find that the time on the ECS is different from the local time, change the time zone for the ECS so that the time on the ECS is the same as the local time.
The process of changing the time zone for a Linux ECS depends on the OS. In this section, the CentOS 6.x 64bit OS is used to demonstrate how to change the time zone for a Linux ECS.
- Log in to the ECS.
- Run the following command to switch to user root:
su - root
- Run the following command to obtain the time zones supported by the ECS:
In the terminal display, the /user/share/zoneinfo directory contains a hierarchy of time zone data files. Use the directory structure shown in Figure 1 to obtain your desired time zone file.
Figure 1 Time zones supported by the ECS
The directory structure shown in Figure 1 includes both time zones and directories. The directories contain time zone files for specific cities. Locate the time zone for the city in which the ECS is located.
- If you are to use the time zone for Hong Kong, the directory in which the time zone file is stored is /usr/share/zoneinfo/Hongkong.
- If you are to use the time zone for Paris, France, run the ls /usr/share/zoneinfo/Europe command to obtain the directory /usr/share/zoneinfo/Europe/Paris.
- Set the target time zone.
- Run the following command to open the /etc/sysconfig/clock file:
- Locate the ZONE entry and change its value to the name of the desired time zone file.
- If the target time zone is for Hong Kong, change the ZONE entry value to Hongkong:
- If the target time zone is for Paris, change the ZONE entry value to Paris:
- Press Esc. Then, run the following command to save and exit the /etc/sysconfig/clock file:
- Run the following command to check whether the /etc/localtime file is available on the ECS:
- If the file is available, go to step 7.
- If the file is not available, go to step 8.
- Run the following command to delete the existing /etc/localtime file:
- Run the following command to create a symbolic link between /etc/localtime and your time zone file so that the ECS can find this time zone file when it references the local time:
ln -sf /usr/share/zoneinfo/Hongkong /etc/localtime
- Run the following command to restart the ECS so that all services and applications running on the ECS use the new time zone:
- Log in to the ECS again and run the following command as user root to check whether the time zone has been changed:
ls -lh /etc/localtime
- Log in to the ECS.
- Click the time display on the far right side of the task bar located at the bottom of your screen. In the dialog box that is displayed, click Change date and time settings.
The Date and Time is displayed.
Figure 2 Date and Time
- Click Change time zone.
The Time Zone Settings page is displayed.
- In the Set the time zone pane, choose the target time zone from the Time zone drop-down list.
- Click OK.