Jump to content

Set system timestamp at runtime


killerb

Recommended Posts

Working with PHP 5.2.6 where date() and time() are used all the way through instead of DateTime object, wanting to test some scripts where certain actions happen on the nth day of the month. We obviously can't wait until the nth day of month to run the tests, would be quite good to be able to set timestamp at runtime similar to setlocale but giving an explicit timestamp, trying DateTime::setTimestamp gives the "undefined method" error since it is a 5.3 feature. Is there a way to do this without changing the server clock, sysadmin is resistant to requests lmao.

Link to comment
https://forums.phpfreaks.com/topic/179273-set-system-timestamp-at-runtime/
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi, yes it is an option to install the system on localhost and set the client dns to my IP so peer can perform tests, however was wanting to know if it is possible to set PHP's time() value at runtime because that would be much easier and preferable, guess from answers here its not the easiest solution..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.