ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Date Comparison Query

May 01, 2012 11:27am

Subscribe [1]
  • #1 / May 01, 2012 11:27am

    kev_horan

    50 posts

    Hi there,

    On EE 1.6.x Is it possible to create Global Date variable which can be used to check against to determine if a piece of content was published after a specific date?

    So you could have something like…

    {if "{entry_date format='%m%d%Y'}" > "{change_date format='%m%d%Y'}"}
    ...
    {if:else}
    ...
    {/if}

    thanks
    Kevin

  • #2 / May 02, 2012 10:33am

    Dan Decker

    7338 posts

    Hi Kevin,

    Perhaps.

    You would need to store the date in the Global Variable in the proper format. So the *content* of the variable would be:

    05222012

    and you would name it change_date. Then your code would look similar to this:

    {if "{entry_date format='%m%d%Y'}" > "{change_date}"}
    ...
    {if:else}
    ...
    {/if}

    Based on ExpressionEngine’s Parse Order, that should work.

    Cheers,

     

     

  • #3 / May 02, 2012 10:56am

    kev_horan

    50 posts

    Cheers Dan, I just figured it out…

  • #4 / May 02, 2012 5:23pm

    Dan Decker

    7338 posts

    Hi Kevin,

    Excellent!

    If you have anything else come up, just ping us in a new thread.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases