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

Previous /Next Day

Participant ,
Feb 07, 2013 Feb 07, 2013

Copy link to clipboard

Copied

I have a page where the day and date is displayed like this.

   < Previous Day      -  Wednesday January  23, 2013   >    Next Day

How do I make it so when the userclicks on < Previous Day    link that they go to Tuesday January  22, 2013 and when they lick on > Next Day they go to Thursday January  24, 2013  etc?

Views

612

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

correct answers 1 Correct answer

Contributor , Feb 07, 2013 Feb 07, 2013

It's tough to provide good answers when we don't know all the details.  Are you passing these pages to a database to pull info for that day?  Do you just need a date selector?

I threw this together in a few minutes (and I'm sure it looks it!)

<cfset somedate = [date of whatever your current page is]>

<cfset yesterday = dateadd("d",-1,somedate)>

<cfset tomorrow = dateadd("d",1,somedate)>

<cfoutput><a href="page.cfm?date=#dateformat(yesterday,"yyyymmdd")#">&lt; Previous Day</a> - #dateformat(somedate,"

...

Votes

Translate

Translate
LEGEND ,
Feb 07, 2013 Feb 07, 2013

Copy link to clipboard

Copied

Make them links with url variables.

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
Participant ,
Feb 07, 2013 Feb 07, 2013

Copy link to clipboard

Copied

Yes. What would the links be?

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
Contributor ,
Feb 07, 2013 Feb 07, 2013

Copy link to clipboard

Copied

LATEST

It's tough to provide good answers when we don't know all the details.  Are you passing these pages to a database to pull info for that day?  Do you just need a date selector?

I threw this together in a few minutes (and I'm sure it looks it!)

<cfset somedate = [date of whatever your current page is]>

<cfset yesterday = dateadd("d",-1,somedate)>

<cfset tomorrow = dateadd("d",1,somedate)>

<cfoutput><a href="page.cfm?date=#dateformat(yesterday,"yyyymmdd")#">&lt; Previous Day</a> - #dateformat(somedate,"mmmm dd, yyyy")# - <a href="page.cfm?date=#dateformat(tomorrow,"yyyymmdd")#">Next Day &gt;</a></cfoutput>

But "somedate" would have to come from somewhere.  Your database?  Hard to know without some more info.

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