How Can We Help?
Adjusting ESX host Time Zone
During installation, a time zone was selected for an ESX host that does not match the desired time zone. This article provides steps to change the time zone.
Note: An ESX host with an incorrect date and time or time zone passes on that incorrect information. When a virtual machine boots up it seems to get its initial time from the BIOS hardware clock which comes from the ESX host. Solution
ESX hosts
To change the time zone:
Note: It is not necessary to reboot the ESX host after following this procedure.
- Log into the ESX service console as root.
- Find the desired time zone under the
/usr/share/zoneinfodirectory. Some regions have multiple files in a subdirectory. For example,UScontains several files, each representing a time zone.
Note: The example below uses/usr/share/zoneinfo/US/Pacificas the new time zone file.
- Use
nano(or another text editor) to open the/etc/sysconfig/clockfile. For more information, see Editing files on an ESX host using vi or nano (1020302).
On the command line, run the command:nano /etc/sysconfig/clock
- Edit this file to show the relative path to the file representing the new time zone, and ensure that UTC and ARC are set as shown:
ZONE="US/Pacific"
UTC=false
ARC=false
- Copy or link the desired time zone file to
/etc/localtime. Continuing the example using US/Pacific:
- To copy, run the command:
cp /usr/share/zoneinfo/US/Pacific /etc/localtime
- To link, run the command:
ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
Note: If you receive anoverwrite `/etc/localtime'?prompt, answeryto replace the file representing the old time zone. Again, it is not necessary to reboot the ESX host after updating/etc/localtime.
- To copy, run the command:
- Confirm that
/etc/localtimehas been updated with the correctzoneinfodata:
- Reference the
zoneinfofile used in step 2, and compare it to/etc/localtimeusing thediffcommand:diff /etc/localtime /usr/share/zoneinfo/US/Pacific
If the files are identical, your prompt returns without any output.
- If
/etc/localtimeis not the same as the/usr/share/zoneinfo/your_location, the output from thediffcommand appears similar to:Binary files /etc/localtime and /usr/share/zoneinfo/US/Pacific differ
If the files are not the same, repeat step 5.
- Reference the
After updating /etc/localtime with the correct zoneinfo data, confirm the system and hardware clocks are correct. Use the Linux date command to check and set the correct time if necessary, and set the hardware clock to match the correct system time.
- Set the system clock to the local date and time:
date MMDDhhmmYYYY
- Update the hardware clock with current time of the system clock:
/sbin/hwclock --systohc
Notes:
- Upon booting, ESX runs
/etc/rc.d/init.d, which reads/etc/sysconfig/clockto set the system clock based on the hardware clock’s current time and the configured time zone information. To synchronize ESX to an external time reference, see Installing and Configuring NTP on an ESX host (1339).
- You may be required to restart the vSphere Client for the timezone information to be updated within the GUI.
- For more information about timezones, including issues with Daylight Saving Time (DST), search the VMware Knowledge Base.
Note: If you still cannot adjust the ESX host time zone after trying the steps in this article, please file a support request with VMware Support and note this Knowledge Base article ID (1436) in the problem description. For more information, see Filing a Support Request in My VMware (2006985).
ESXi hosts
ESXi uses UTC time and does not support changing time zones.
The command takes the following parameters:
Usage: esxcli system time set [cmd options]Description:
set Set the system clock time. Any missing parameters will default to the current timeCmd options:
-d|--day=<long> Day
-H|--hour=<long> Hour
-m|--min=<long> Minute
-M|--month=<long> Month
-s|--sec=<long> Second
-y|--year=<long> Year
So, to set the system time to 10th April 2014, 10:18 (am):~ # esxcli system time set -d 10 -H 10 -m 18 -M 04 -y 2014
Also, make sure that we also set the hardware clock time as the system time will revert to this on a reboot:
~ # esxcli hardware clock set -d 10 -H 10 -m 18 -M 04 -y 2014 <- sets the hardware clock to 10th April 2014, 10:18 (am)
To check the hardware and system time we can use the following commands:
esxcli hardware clock get
esxcli system time get
Job done!
