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
https://forums.phpfreaks.com/topic/267334-fake-datetime-on-php-script/
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.

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.

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.