Home > Virtualization > How to Manually Change ESXi Time

How to Manually Change ESXi Time

Although VMware ESXi supports common Linux commands, its implementation is based on busybox. Some of the commands are not supported, or functionalities are reduced. Setting time is one of the cases.

To find out the current time, you issue the following command:

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

~ # date
Sun Jul 13 10:50:59 UTC 2014

Now if you want to use the same date command to change the time, it’s a different story. In fact, the help of the date command works as normal, but when you really type in full command, you’ll see it won’t work.

~ # date -s
date: option requires an argument -- s
BusyBox v1.19.0 (2012-02-29 14:20:08 PST) multi-call binary.
Usage: date [OPTIONS] [+FMT] [TIME]
Display time (using +FMT), or set time
        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion
Recognized TIME formats:
        YYYY-MM-DD hh:mm[:ss]
~ # date -s 2014-07-12 12:00:00
date: Setting date not supported; use <esxcli system time set>

Luckily, it gives hints on what command to use. To find the exact options, you can use –help to find out.

~ # esxcli system time set
You must specify one of year, month, day, hour, minute or second
~ # esxcli system time set --help
Usage: esxcli system time set [cmd options]
  set                   Set the system clock time. Any missing parameters will default
                        to the current time
Cmd 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
~ # esxcli system time set -M 10
~ # date
Mon Oct 12 10:43:52 UTC 2014

With the esxcli command, you can also get the system time. Just change the set to get as follows:

~ # esxcli system time get     

Last, but not least, you should rely on the NTP server to sync up your server’s time in most of times. The only time you should use the change time is you don’t have NTP server, or you simply want to hack something in the ESXi server.

Categories: Virtualization Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.