While working on the ESXi shell you might notice that the “date” command returns the UTC time instead of displaying the correct time zone like ESX Classic does.
This is by design within ESXi and stated in this VMware KB article: ESXi uses UTC time and does not support changing time zones
Although it’s not supported to change the time zone it could come in handy to get the correct time-stamps for custom scripts within the ESXi Shell.
To get the correct time-stamps you only need to add the following line in the beginning of your script:
export TZ=MET<-/+><no of hours>
In my case UTC is off with -1 hour with the actual time, which means that I need: export TZ=MET-1
Please note that this command only changes the time zone for the current Shell session as long as it’s active, so it doesn’t change the system time zone.
Also don’t forget to check the output with daylight saving time if applicable to your current time zone.
felipe1982
/ December 2, 2012what is MET? I’m running esxi 4.1, and I live in Brisbane (GTM+10) I had to use GMT+14 to get the correct time 0.o
Kenneth van Ditmarsch
/ December 2, 2012Middle european time: http://www.worldtimezone.com/wtz-names/wtz-met.html
felipe1982
/ December 3, 2012Just realised that we use minus symbol `-‘ do indicate East of GMT, and plus symbol `+’ to indicate West of GMT.
For Brisbane i used:
`export TZ=”AEST-10″ to indicate GMT +10
source: http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/timezone.html