Hi. I am new to CFC. Can someone help me convert this function from cfscript
to CFML?

<cfscript>
/**
* Returns the day of the month(1-31) of an Nth Occurrence of a day
(1-sunday,2-monday etc.)in a given month.
*
* @param NthOccurrence A number representing the nth occurrence.1-5.
* @param TheDayOfWeek A number representing the day of the week (1=Sunday,
2=Monday, etc.).
* @param TheMonth A number representing the Month (1=January, 2=February,
etc.).
* @param TheYear The year.
*/
function GetNthOccOfDayInMonth(NthOccurrence,TheDayOfWeek,TheMonth,TheYear)
{
Var TheDayInMonth=0;
if(TheDayOfWeek lt DayOfWeek(CreateDate(TheYear,TheMonth,1))){
TheDayInMonth= 1 + NthOccurrence*7 + (TheDayOfWeek -
DayOfWeek(CreateDate(TheYear,TheMonth,1))) MOD 7;
}
else{
TheDayInMonth= 1 + (NthOccurrence-1)*7 + (TheDayOfWeek -
DayOfWeek(CreateDate(TheYear,TheMonth,1))) MOD 7;
}
//If the result is greater than days in month or less than 1, return -1
if(TheDayInMonth gt DaysInMonth(CreateDate(TheYear,TheMonth,1)) OR
TheDayInMonth lt 1){
return -1;
}
else{
return TheDayInMonth;
}
}
</cfscript>


Thanks,

- Ken


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222382
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to