I am really stuck with any idea on how to do this.
Is there any way I can have a dropdown select menu which only shows the dates of Fridays throughout the year?
Any pointers appreciated.
Many thanks
I am really stuck with any idea on how to do this.
Is there any way I can have a dropdown select menu which only shows the dates of Fridays throughout the year?
Any pointers appreciated.
Many thanks
which year? would you want your dropdown to run from jan1 through dec 31? for the current year? for a given year?
or do you want it to list the next 52 weeks starting today (which happens to be a friday)?
give us more info pls
Not coded this up but in pseudo I’d probably start with something like this:
Find the first Friday of the (specified) year and then +7 for every Friday after that.
Loop over the weeks until you hit the end of the year.
If it’s from Today then it should be just a case of working out where you currently are and to keep looping over the days until you get to dayOfWeek() equalling 6.
That’s your day point so then work out how many weeks left in this year and that’s your loop counter.
Cheers,
James
Hi, Thanks for coming back to me.
I would like to list the next 52 weeks of the year from now, so that there are constantly 52 weeks available.
Thanks for your comments James - I’ve been playing with this but just can’t get it to work.
Many thanks
<cfset friday = Now()>
<cfif DayOfWeek(friday) EQ 7 >
<cfset friday = DateAdd("d",6,friday) >
<cfelseif DayOfWeek(friday) LT 6 >
<cfset friday = DateAdd("d",6-DayOfWeek(friday),friday) >
</cfif>
<form>
<select>
<cfoutput>
<cfloop from="01" to="52" index="foo">
<option value='#DateFormat(friday,"yyyy-mm-dd")#'>Fri #DateFormat(friday,"mmm dd yyyy")#</option>
<cfset friday = DateAdd("ww",1,friday) >
</cfloop>
</cfoutput>
</form>
tested
That’s perfect thanks Rudy.