• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Switching content based on a date

Contributor ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

Hi;
I am trying to write a script that will switch some content in my webpage once it hits March 1st. so until march first they get one thing, and after march 1st they get another. Is this possible? If so can someone help me out with the code.

I thought it might work as an IF statement like
<cfif DateFormat(now(), "yyyy" = #Feb 31#>
they get this code
<cfelse>
they get this code as of March 1st.
</cfif>

I need it to sta that way until after June 2007
Can anyone help me figure out a good way to accomplish this?
Thank you.
TOPICS
Advanced techniques

Views

244

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

Why are you using date formats? Use actual date values for this:

<CFIF now() LT CreateDate(2007,3,1)>
Content before March 1
<CFELSE>
Content starting March 1
</CFIF>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 31, 2007 Jan 31, 2007

Copy link to clipboard

Copied

LATEST
What's supposed to happen in June? If you have constantly changing content, perhaps there is a better way than changing your code all the time.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation