Ok, using this code:

<CFLOOP FROM="1990" TO="2010" INDEX="year">
<CFLOOP FROM="1" TO="12" INDEX="month">
<CFLOOP FROM="1" TO="#DaysInMonth('#year#-#month#-01')#" INDEX="day">

<CFSET Today = CreateODBCDate('#year#-#month#-#day#')>
<CFSET thisDOW = DayOfWeek(today)>
<CFSET thisdaylastyear = DateAdd('ww',-52,today)>
<CFSET lastDOW = DayOfWeek(thisdaylastyear)>

<CFIF thisDOW NEQ lastDOW>
        <CFOUTPUT>
        <P><FONT COLOR="red">[*****NO MATCH*****]</FONT><BR>
        #Today# #DayOfWeekAsString(DayOfWeek(today))#<BR>
        #ThisDayLastYear# #DayOfWeekAsString(DayOfWeek(ThisDayLastYear))#</P>
        </CFOUTPUT>
</CFIF>

</CFLOOP>
</CFLOOP>
</CFLOOP>

I've concluded that <CFSET thisdaylastyear = DateAdd('ww',-52,today)>
produces the correct day every single time...

Works for me! Did I miss something?

> > > -----Original Message-----
> > > From: Tony Schreiber [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, August 05, 2003 10:59 AM
> > > To: CF-Talk
> > > Subject: RE: How to compute this DAY (not Date) last year?
> > >
> > >
> > > > > For a sales report, I need to figure out what the date is for
> > > > > this DAY last year. So for today, 8/5/2003 Tuesday, I need to
> > > > > figure out what the date was for this Tuesday last year
> > > > > (which was 8/6/2002).
> > > > >
> > > > > It's not as simple as today-364 days right? You've got leap
> > > > > years of course and probably some other wrenches in there as
> > > > > well. It's actually probably simple, but my brain is fried
> > > > > right now. ;)


Tony Schreiber, Senior Partner                  Man and Machine, Limited
mailto:[EMAIL PROTECTED]                   http://www.technocraft.com

http://www.is300.net The Enthusiast's Home of the Lexus IS300 since 1999
  ***** PARTS STORE NOW OPEN *****         http://www.is300.net/store/
http://www.simplemessageboard.com    Free Forum Software for Cold Fusion

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to