Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding dates but omitting Sunday 1

Status
Not open for further replies.

rosn459

Programmer
Sep 18, 2003
37
US
The search function is down and I'd like to resolve this today.

If I have a date (today for example) and I want to show the date six days in the future; but, I want to omit Sunday as a day.

How would I do this? I've gotten this far:

<cfset FutureDate = #dateformat(Today(), 'mm/dd/yyyy')#+6>
<cfoutput>#FutureDate#</cfoutput>

The result of the above is 12/2/2004 and I need it to be 12/3/2004.

Thanks so much!!!
 
You're close, you need to use the DayOfWeek function to find out what day of the week your "FutureDate" is on.

Try this:
Code:
<cfset FutureDate = #dateformat(Today(), 'mm/dd/yyyy')#+6>
<cfif DayOfWeek(FutureDate) EQ 1>
  <cfset FutureDate = FutureDate+1>
</cfif>
<cfoutput>#FutureDate#</cfoutput>



Hope This Helps!

Ecobb
Beer Consumption Analyst

"My work is a game, a very serious game." - M.C. Escher
 
gotcha covered.

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
-Douglas Adams (1952-2001)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top