To make M!ke's words come alive...

<cfset counter = 1>
<cfset today = Now()>
<cfset endOfTheMonth = CreateDate(Year(today), Month(today),
DaysInMonth(today))>

<cfoutput>

<cfloop from="#DaysInMonth(today)#" to="1" index="i" step="-1">

        <cfif DayOfWeek(DateAdd("d", -counter, endOfTheMonth)) EQ 5>
                The last Thursday is: #DateFormat(DateAdd("d", -counter, 
endOfTheMonth),
"dd/mm/yyyy")#
                <cfbreak>
        </cfif>

        <cfset counter = counter + 1>

</cfloop>

</cfoutput>

... I know you asked for a SQL answer, but ColdFusion is so much more fun
:OD

I only checked this on a few months and I reckon there might be a simpler
answer.

Ade

-----Original Message-----
From: Dawson, Michael [mailto:[EMAIL PROTECTED]
Sent: 20 January 2005 19:04
To: CF-Talk
Subject: RE: OT-SQL DATE QUESTION


I think you will need to loop backwards from the last day of the month
until you find the first (last) Thursday.  You will probably need to put
this in a stored procedure.

You will also need to use a date function that returns "Monday",
"Tuesday", etc so you can look for "Thursday".  Then, you can make note
of that particular date and compare it to the passed-in date.

M!ke

-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 20, 2005 10:25 AM
To: CF-Talk
Subject: RE: OT-SQL DATE QUESTION

Are you trying to determine what day of the month, the last Thursday
falls on Or just if the 31st in this case is a Thursday?

-----Original Message-----
From: Eric Creese [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 20, 2005 11:19 AM
To: CF-Talk
Subject: OT-SQL DATE QUESTION

Okay I have a function that retrieves the last day of the month based on
feeding it todays date which would return 1/31/2005. I am trying to
modify this function to determin if today is the last Thursday of the
month. Does anyone have any ideas for this? I have tried a few things
like using the day of the week number but I am getting nothing and
looked out on the web and have not found much. This is for SQL2K
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 21/01/2005


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191425
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to