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
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..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.