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.

Conditionals based on days of the week?

February 25, 2010 5:19pm

Subscribe [4]
  • #1 / Feb 25, 2010 5:19pm

    CityDesk

    16 posts

    I am looking to build a template that changes based on the day of the week. Meaning the code would have to look something like: “if Monday, do this. If Tuesday, do that”.

    I have no idea if this is possible or where to start looking for solutions.

    Can anyone point me in the right direction?

    Thanks in advance.

  • #2 / Feb 25, 2010 5:30pm

    Ingmar

    29245 posts

    Sure:

    {if "{current_time format='%w'}" == "1"} It's Monday!{/if}
  • #3 / Feb 25, 2010 5:44pm

    Justin Long

    196 posts

    Alternatively you could use

    {if "{current_time format='%l'}" == "Monday"} It's Monday!{/if}
    or
    {if "{current_time format='%D'}" == "Mon"} It's Monday!{/if}

    if you wanted your CSS rules to match

  • #4 / Feb 25, 2010 6:32pm

    CityDesk

    16 posts

    Much thanks to both of you!

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

ExpressionEngine News!

#eecms, #events, #releases