2

We're running an annual event website and we're keen to simulate the site for a different date. In other words, add say 3 months to the current date/time so we can try out some options for when the event's finished.

Anyone have any thoughts on where to start with this?

5
  • How are the events in the system? Are the entered as regular channel entries or are you using an addon? Are they output to the template files based on publish date or do you have a separate field for the event date?
    – Ian
    Apr 5 '13 at 16:32
  • They're in as regular EE date fields in channel entries. The publish date isn't been taken into account at all for individual events. Apr 5 '13 at 16:36
  • 1
    In that case can you not just edit the dates of a few of the entries to be past events so that you can test?
    – Ian
    Apr 5 '13 at 17:45
  • Thanks Ian. We have some more generic settings to be applied after the festival, so changing the times of specific events wouldn't really allow us to test what we'd like to. Apr 5 '13 at 19:28
  • Ah gotcha. Yes if there are several dependencies then Derek's suggestion is definitely a quicker way. If it's just checking date logic I normally find it just as easy to quickly edit some entry dates to make sure they're being handled correctly in the system.
    – Ian
    Apr 5 '13 at 19:36
2

Ian's comment works, though this will be less laborious...

Open /system/expressionengine/libraries/Localize.php, and look inside the constructor (around line 53 or so). Comment out the setting of $this->now and change it like so:

// Fetch the current local server time and convert it to GMT
// $this->now = time();

// Temporarily setting the date to 3 months in the past
$this->now = strtotime('3 months ago');
1
  • Don't forget to mark Derek's answer as correct if it solves the issue. It helps for others in the future to quick find a solution that works.
    – Ian
    Apr 5 '13 at 20:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.