Advance the system date

Advance the system date


Is there a way to change the system date so that we are able to test our system as if we were in the future (or indeed the past)?

I'm wanting to change the date to be the 31st October so we can test our month end functionality.


Hi Kieran,

The short answer is "no". Of course, theoretically you could try to adjust the server's date or time, but you really shouldn't want to, nor is it trivial, as modern computers are linked up to other computers, and they kinda expect to have the same (UTC) date/time or all mayhem breaks loose. Not to mention having to reset the date/time back to the proper date/time after testing, and getting all the problems of DST, but worse.

In general, if you want to test whether date-triggered software runs as expected, create some setting that allows you to adjust the offset from the desired day. For example, have a site property "AdjustEndOfMonthByDays", and in your end-of-month detection code, add the value of the site property to the current date before checking. Alternatively, have a "EndOfMonthCheckSkip" site property boolean, that if True just always assumes it's end of month. And you can probably come up with some variations on this.