Something like this may help you:

<cfset tDate = createDate(2007,5,13)> <!--- Beginning Date --->

<cfset dow = dayOfWeek(tDate)> <!--- Day of Week : 1 = Sunday, 7 = Saturday
--->

<cfset dowStr = "">

<cfswitch expression="#dow#">
    <cfcase value="1"><cfset dowStr = "First"></cfcase>
    <cfcase value="2"><cfset dowStr = "Second"></cfcase>
    <cfcase value="3"><cfset dowStr = "Third"></cfcase>
    <cfcase value="4"><cfset dowStr = "Fourth"></cfcase>
    <cfcase value="5"><cfset dowStr = "Fifth"></cfcase>
    <cfcase value="6"><cfset dowStr = "Sixth"></cfcase>
    <cfcase value="7"><cfset dowStr = "Seventh"></cfcase>
</cfswitch>

<cfset woy = week(tDate)> <!--- Week of Year --->

<cfset yr = year(tDate)> <!--- Year --->

<cfoutput>
#dowStr# day of week #woy# #yr#
</cfoutput>

Your could easily make the cfswitch statement into a UDF called something
like DayOfWeekOrder.

On 5/9/07, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote:
>
> I'm building an app where I am keeping track of sales on a weekly basis,
> so
> I am storing the number of the week (as a tinyint) and the year (as a
> smallint).  Now there is a requirement to generate a report where the date
> of the first day of the week (i.e. 5/13/2007 being the date fo the first
> day
> of week 20 of 2007).  While I can certainly rebuild this portion of the
> app,
> I would prefer not to.  Any ideas on how to convert a week/year into the
> first date of week/month/year format using either MS SQL Server of CF7?
>
> Thanks
>
> Pete
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:277461
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to