Skip to main content
Known Participant
July 6, 2006
Question

create timed outputs?

  • July 6, 2006
  • 1 reply
  • 414 views
hi everyone. here's what i have. i have a table with about 200 calendar dates in it all the way from august 06 to march 07. i was wondering if there is some way to create a script that will create a 7 day time span from the current date and output the corresponding dates from the table?

ex: today is 07/05/2006. so i'd like all dates in the table between 07/05/2006-07/12/2006 to display. then on 07/06/2006, all dates in the table between 07/06/2006-07/13/2006 should display.

hope this makes sense, thanks a ton in advance!
    This topic has been closed for replies.

    1 reply

    Inspiring
    July 6, 2006
    You don't even need your table. Using cold fusion functions now(), dateadd, and dateformat, plus the cfloop tag, it's pretty easy to output 7 dates.
    straffenpAuthor
    Known Participant
    July 6, 2006
    dan, thanks for the reply. i have all my dates stored in the table, wouldn't i need to query the table to get the dates? can you provide a sample script or a place where i can get a tutorial? thanks again.
    Inspiring
    July 6, 2006
    quote:

    Originally posted by: straffenp
    dan, thanks for the reply. i have all my dates stored in the table, wouldn't i need to query the table to get the dates? can you provide a sample script or a place where i can get a tutorial? thanks again.

    The cfml reference manual shows usage of all functions and tags. If you don't have one, the internet does.

    Here is some sample code on how to output 7 days, starting today.
    <cfset theday = now()>
    <cfoutput>
    <cfloop from = "1" to = "7">
    #theday#
    <cfset theday = dateadd("d", 1, theday)>
    </cfoutput>
    </cfloop >