I have to test the licensing mechanism of our application. One part of the test is to set the date to the past or future.

This worked well using my own PC, but it has some bad effects, e.g. if I save test reports, it will add the current date and time, which looks like I performed the test in the past or future. Also, since time is synchronized via NTP by our IT department, using my own PC does not work reliably any longer.

I tried using virtual PCs, but they tend to synchronize the time with the local PC. That can be turned off, but usually I want it turned on, so it's just inconvenient.

In another scenario, I am testing a client-server application and see what happens if the client time and server time differ. I'd like to do that on one machine without needing a second virtual OS just to change the time.

I wonder whether there's a more lightweight application that allows changing the time reported to a single application only. Something like a sandbox or an API hook.

Such a tool

  • must run on Windows (7 x64, 10 x64)
  • must be gratis
  • may be a command line tool
  • must change the offset of the clock reported to the application by some months to just a few minutes.

Note: I don't want to change file timestamps.

2 Answers 2


NirSoft RunAsDate was helpful.

RunAsDate is a small utility that allows you to run a program in the date and time that you specify. This utility doesn't change the current system date and time of your computer, but it only injects the date/time that you specify into the desired application.

It fulfills the requirements

  • works for Windows
  • is gratis
  • comes with a GUI but can also be run as a command line tool
  • can change the date/time in many ways, e.g. absolute or by offset

    RunAsDate.exe 22\10\2015 12:35:22
    RunAsDate.exe Hours:-10

I was not able to make it work in the first few attempts, because

  • the application started in a different working directory than expected. Creating a Desktop shortcut and changing the working directory manually in the shortcut helped
  • there seems to be a limitation in the length of Desktop shortcuts. A part of the command line parameters got cut, so the application didn't even start. When I changed that to a batch file, everything worked fine.
  • You can confirm this program works simply by using notepad (for example): RunAsDate.exe 22\10\2015 C:\Windows\notepad.exe, followed by pressing F5 which should paste "the current date". Also, note that one has to use the absolute path to the program you wish to run with a fake date.
    – Velda
    Jul 13, 2023 at 17:09

I wonder whether there's ... something like a sandbox or an API hook.

Of course there is. Microsoft Sandbox environment is available since build 1903 and addresses the problems alike you describe.

It is:

  • Part of Windows – everything required for this feature ships with Windows 10 Pro and Enterprise. No need to download a VHD!
  • Pristine – every time Windows Sandbox runs, it’s as clean as a brand-new installation of Windows
  • Disposable – nothing persists on the device; everything is discarded after you close the application
  • Secure – uses hardware-based virtualization for kernel isolation, which relies on the Microsoft’s hypervisor to run a separate kernel which isolates Windows Sandbox from the host
  • Efficient – uses integrated kernel scheduler, smart memory management, and virtual GPU

Of course, if you don't like MS-native solutions, you can try third-party alternatives.

  • While the Windows Sandbox is very useful, it does not (seem to) allow specifying a different date/time than the host system.
    – 3ventic
    Sep 7, 2021 at 23:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.