Change the time

I want to change the time of the container to test some cases related to dates. Is it possible to change the time/date of the server/container so that I can execute these test cases on WordPress?

Hey @menakas

There isn’t a simple way of doing this with Local. Since the current release of Local makes use of Docker and containers, you might be able to log into the VirtualMachine and manually adjust the date which should update all of the containers with the new time.

I haven’t tried it myself, but in theory it should work!

Thanks Ben,
I did try logging in via ssh, but there are permission issues for changing date/time. I would appreciate it if you can take a look at this screenshot and tell me if anything can be done differently to achieve my purpose.

Thanks and cheers,
Menaka S.

Hey @menakas

I was able to get the date to be set for a little bit, but it looks like there is an auto time syncronization job that is run about every 10 seconds:

You might be able to track down and kill that process. One other option would be to make use of the latest version of Local (v5) which doesn’t rely on Docker or Virtualbox:

From there you might be able to manually update the time of the host machine in order to do the testing that you want to do.

So I got this to work. I’m on a Windows machine so YMMV on other setups

First I opened a command window in Windows and went to c:\Program Files\Oracle\VirtualBox - basically where VirtualBox is installed on your machine

Looking here:https://www.virtualbox.org/manual/ch09.html#disabletimesync I enetered this:
VBoxManage setextradata “VM name” “VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled” 1

I replaced VM Name with local-by-flywheel which is the name of the machine on VirtualBox

I restarted Local

Then I opened the command window in VirtualBox and and changed the date (date --set=“2019-12-10 11:00:00”)

That seems to work…

Hi nyrsimon
It works perfectly!
Thanks a ton.

Regards
Menaka S.