I would like to be able to change the date for a .NET process from within that process whilst it is running. I am not sure if this is even possible. Let's assume W7 or greater, 32 and 64bit. From within the process, when I call something like DateTime.Today, i would like it to report the date of my choosing. I am not too concerned about changing the time, i would like the time of day to remain unchanged at the moment.
As far as I can tell this is not a duplicate question,I have seen posts such as change-system-date-programatically that make a call to SetSystemTime but this changes the datetime for the whole machine, I would like to change it just for that process.
I have been using NirSoft RunAsDate which uses an application to call the .net executable and this works fine, I would just like to be able to control this myself from within the application. The fact that this tool can make the change suggests that it is possible.
The background is that I am testing some functionality which behaves differently depending on the current date and i need to able to simulate this at any given time and make the application behave as if it was running on a given date. I dont want to alter teh system clock as this may have unintended consequences for other applications that are running
(first post - go easy on me)