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 compare

February 17, 2011 9:41am

Subscribe [2]
  • #1 / Feb 17, 2011 9:41am

    brebre

    75 posts

    I have an entry date as a custom field.

    Can I compare my custom filed date to the current date to see if the time has lapsed?

    {if {tour1-until format="%D, %d %F"} < {date format="%D, %d %F"}}
    even has lapsed
    {/if}

    cheers.

  • #2 / Feb 17, 2011 10:07am

    SHERPA Global

    33 posts

    Dates are saved as Unix time (http://en.wikipedia.org/wiki/Unix_time) which is in fact just an integer.

    So you can simply compare the two variables no need to use the format “modifier”

  • #3 / Feb 17, 2011 3:46pm

    Ingmar

    29245 posts

    It’s definitely recommended to use a format parameter:

    {if "{tour1-until format='%U'}" < "{current_time format='%U'}"}
    event has lapsed
    {/if}
  • #4 / Feb 19, 2011 7:57am

    brebre

    75 posts

    awesome, worked a treat.
    thanks.

  • #5 / Feb 19, 2011 9:32am

    Ingmar

    29245 posts

    Very glad to hear it. Please post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases