I am using the Grid field built into EE, 2.8.1, to display event dates. In the Grid column I have an event date field to let you know when the event starts. What I would like to do is have this date field then somehow have the field no longer display 24 hours after the event start time.

I got this working by setting up an expiration date field but thought it would be easier for the end user not to have to fill that in since it is not the best workflow for the data entry person.

Is there a certain way to automagically do this?

Here is my current template code. I am using the Math Plus plugin to help with math but not sure if I am even approaching this correctly.

        {bio_pull_in_tour_dates:tour_dates orderby="bio_pull_in_tour_dates:tour_dates:tour_date_of_show" sort="asc"}

        {if {bio_pull_in_tour_dates:tour_dates:tour_date_of_show format="%U"} < {exp:math_plus decimal_places="0" calculate="({var1} + {var2})" var1="{bio_pull_in_tour_dates:tour_dates:tour_date_of_show format="%U"}" var2="86400" }{math_plus_result}{/exp:math_plus}}

                <td class="col-md-2">{bio_pull_in_tour_dates:tour_dates:tour_date_of_show format="%n/%j/%y"}</td>
                <td class="col-md-2">{bio_pull_in_tour_dates:tour_dates:tour_venue}</td>
                <td class="col-md-2">{bio_pull_in_tour_dates:tour_dates:tour_city}, {bio_pull_in_tour_dates:tour_dates:tour_state}</td>

                <td class="col-md-2">{bio_pull_in_tour_dates:tour_dates:country}</td>
                <td class="col-md-4">
                    Start Time: {bio_pull_in_tour_dates:tour_dates:tour_date_of_show format="%U"}<br/>
                    Current Time: {current_time format="%U"}<br/>
                    Expire Time: {exp:math_plus decimal_places="0" calculate="({var1} + {var2})" var1="{bio_pull_in_tour_dates:tour_dates:tour_date_of_show format="%U"}" var2="86400" }{math_plus_result}{/exp:math_plus}<br/>
                     <br/>Marked Expire </td>

So I am taking the date of show field converting it's format to Epoch seconds. Then I am comparing the start time to the sum of the start time plus 86400 since that is how many seconds are in a day. this should work but it does not appear to do so.

I hope this makes sense. If there are better ways to get the row to hide after a certain amount of time please point me in the correct direction,

thanks in advanced.

  • Can't you update EECMS?
    – Sobral
    Jun 14, 2015 at 17:47
  • Yes I can update. How will that help?
    – johnHoysa
    Jun 14, 2015 at 23:19

1 Answer 1


First: a value will always be smaller than itself plus any other value. You need to compare the date against the {current_time}.

Second, you need to parse all values before the Math Plus plugin, so the data can be available to it.

{exp:channel:entries paser="inward" [...]}

If you can update EECMS, you should. The version 2.9 has new mathematical conditionals operators that can help you to keep your code simple.

{if bio_pull_in_tour_dates:tour_dates:tour_date_of_show + 86400 > {current_time} }

I'm not sure if you gonna need to put bio_pull_in_tour_dates:tour_dates:tour_date_of_show between '{ and }'. Please, test and help me to improve this answer.

  • Thanks for telling me to compare to current time, that did the trick!
    – johnHoysa
    Jun 16, 2015 at 0:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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