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 conditionals issue

December 14, 2010 5:16pm

Subscribe [1]
  • #1 / Dec 14, 2010 5:16pm

    CPRIT Support

    2 posts

    I’m pulling my hair out on trying to get a set of date conditionals to work. How can I check for a custom date field that’s not set to anything? I’ve tried converting and comparing to 0, I’ve tried comparing to an empty string, etc.

    e.g. {if "{app_enddt format='%U'}” > “31536000”}

    when I output the value of the field the result appears blank, but what is the real value?

    Also, the parsing issues in EE are making me batty as well.

    Statements like: {if ("{current_time format='%U'}” > “{rel_dt format='%U'}”) AND (”{current_time format='%U'}” < “{app_enddt format='%U'}”)}

    are being parsed too late - any solutions/known issues? I may be overlooking something silly.

    objective: what I’m trying to do is check to see if a date value is even set, if it isn’t my status is: continuously open. If a date is set, then I need to make sure that current time is in between an arbitrary starting date and that set date. If so, then my status is currently open, otherwise it’s currently closed. All dates are custom fields and I’m comparing with current time.

  • #2 / Dec 15, 2010 7:53am

    Sue Crocker

    26054 posts

    Welcome to the ExpressionEngine forums, CPRIT Support.

    Since you’re new to the EE forums, have you seen EEWiki:// How to Post a Support Request?

    This is a *very* simplistic example, but see if it helps.

    {exp:weblog:entries weblog="default_site"}
    <h3>{title}</h3>
    <p>Event Date: {event_date}<br />
    {if event_date ==""}<br />
    There is no event date.<br />
    {/if}<br />
    {current_time}<br />
    {if current_time > event_date}<br />
    Event date is in the past<br />
    {if:else}<br />
    Event date is in the future. <br />
    {/if}<br />
    {/exp:weblog:entries}

    You shouldn’t need to use %U in your testing..

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

ExpressionEngine News!

#eecms, #events, #releases