23

Does anybody know of a Windows tool to report fake dates/times to a process?

Apparently there are Linux programs that can be used to test how the software will react in the future / in a different timezone or to trigger scheduled tasks without actually modifying the system clock. Are there such programs for Windows?

2 Answers 2

21

RunAsDate can do this.

Nirsoft RunAsDate v1.41 - Run a program with the specified date/time

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. You can run multiple applications simultaneously, each application works with different date and time, while the real date/time of your system continues to run normally.

https://www.nirsoft.net/utils/run_as_date.html

Sign up to request clarification or add additional context in comments.

1 Comment

Awesome, thanks. Though it doesn't seem to affect the grand-child processes that the initial process might start, it is better than nothing.
0

Starting about 2 years ago, I always abstract the call to DateTime.Now (C#) through a Utility class. This way I can always fake the date/time if I want to, or just pass it directly through to DateTime.Now.

Sounds similiar to what BillH suggested.

public class MyUtil
{
  public static DateTime GetDateTime()
  {
     return DateTime.Now.AddHours(5);
     //return DateTime.Now;   
  }
}

2 Comments

You mean for this project, right? It wouldn't work system-wide, right? :-)
Correct. Only for a single project. Would be nice if the system gave you a way to abstract this away (at a system level). Can Docker do this? Use a false / incorrect time from the underlying system? I know a Virtual Machine could.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.