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 math?

June 17, 2011 3:49pm

Subscribe [2]
  • #1 / Jun 17, 2011 3:49pm

    elwynor

    5 posts

    I have a template I’m working on that needs to conditionally display a link around text depending on when it is.

    Basically, I want to do this:

    {if {date format="%W-23"} < week_number} link code {if:else} just text {/if}

    Essentially, there’s a value in the entry called week_number, and because this particular template is for a mid-year set of data, I want to check the week number against the week of year (%W) minus 23.  So week 1 for the data is equal to week 24 of the year.

    I get an error:

    Parse error: syntax error, unexpected T_STRING in /web/abgclass.com/newsite/kingsarms/expressionengine/libraries/Functions.php(640) : eval()‘d code on line 36

    I can’t find any documentation discussing date math. 

    Thanks in advance.

  • #2 / Jun 19, 2011 10:38am

    Kernon

    173 posts

    You can’t add an arithmetic expression to the format of a date variable.  Furthermore, I don’t believe EE conditionals support arithmetic expressions.

    You could add a bit of PHP to your template to accomplish this, or get a plugin, such as MX Calculator.  But, you’ll need to find a plugin that works within a conditional.

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

ExpressionEngine News!

#eecms, #events, #releases