killerb Posted October 27, 2009 Share Posted October 27, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/179273-set-system-timestamp-at-runtime/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 27, 2009 Share Posted October 27, 2009 without changing the server clock, sysadmin is resistant to requests You should be developing and testing code on a development system, not a live server. Quote Link to comment https://forums.phpfreaks.com/topic/179273-set-system-timestamp-at-runtime/#findComment-945852 Share on other sites More sharing options...
killerb Posted November 5, 2009 Author Share Posted November 5, 2009 Hi, thanks for help, yes it is a development server but I am a programmer and not sysadmin, wanting to know if I can do it with PHP without having to open a ticket. Quote Link to comment https://forums.phpfreaks.com/topic/179273-set-system-timestamp-at-runtime/#findComment-951455 Share on other sites More sharing options...
rossmurphy Posted November 5, 2009 Share Posted November 5, 2009 Why don't you test on your friend localhost. Change your own system clock. Quote Link to comment https://forums.phpfreaks.com/topic/179273-set-system-timestamp-at-runtime/#findComment-951473 Share on other sites More sharing options...
killerb Posted November 16, 2009 Author Share Posted November 16, 2009 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.. Quote Link to comment https://forums.phpfreaks.com/topic/179273-set-system-timestamp-at-runtime/#findComment-958219 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.