Jump to content

Fake Date/Time on PHP Script


Ninjakreborn

Recommended Posts

I know if your working on something locally you can time forward your PC to make it seem like it's a different date/time. What happens fi your working on a server

though. Is there a way to make PHP think your current date/time is different than what it is. Like a way to set the current date/time that PHP thinks your on?

 

Perhaps a global setting to hardcode the date/time for a script. So if you want the script to think it's currently....3:00 A.M. on 8/20/2012 is there a way to do that

without having to pull the files locally and time forward your system?

Link to comment
Share on other sites

Is there any particular reason you WANT to do this?

 

All date/time functions accept a timestamp as an argument.  If one is not provided, it uses "now."  You could write your script to have a test flag which will override the value of every date function.

Link to comment
Share on other sites

I have a project i'm working on a server.  The client is able to pull down from his system and time forward stuff (fantasy sports). So me testing is a little tricky, since i'm working on the server (replacement laptop). I found an alternative for now, but curious if there was a way to do that.

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.