|
Can I ask why you’re converting it to CFML? You can use both CFscript and CFML inside a CFC with no problem. If you’re worried about something like, say, making this method private/protected from other objects, then this should do you ok (note, I didn’t test it so there may be a typo but you get the idea):
<cffunction name="GetNthOccOfDayInMonth" access="private" returnType="numeric"> <cfargument name="NthOccurrence" type="numeric"> <cfargument name="TheDayOfWeek" type="numeric"> <cfargument name="NTheMonth" type="numeric"> <cfargument name="TheYear" type="numeric">
<cfscript> 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>
</cffunction>
hope that helps.
Nolan Erck -----Original Message-----
Hi. I am new to CFC. Can
someone help me convert this function from cfscript to CFML? The information contained in this e-mail is confidential and may contain privileged information exempt from disclosure under applicable law. The information is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, employee, or agent responsible to deliver it to the intended recipient, you are hereby notified that any use, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please delete the message from your computer and immediately notify the sender by telephone (you may call collect) at 916-569-5400 or by e-mail to [EMAIL PROTECTED] Thank you.
---------------------------------------------------------- |
- RE: [CFCDev] CFscript function Nolan Erck
- Re: [CFCDev] CFscript function Haikal Saadh
- [CFCDev] Defining CFC using cfscript John Ottenbacher
- Re: [CFCDev] Defining CFC using cfscript Matt Woodward
- RE: [CFCDev] Defining CFC using cfscript John Ottenbacher
- RE: [CFCDev] Defining CFC using cfscript Seth MacPherson
- Re: [CFCDev] Defining CFC using cfscript Haikal Saadh
- Re: [CFCDev] Defining CFC using cfs... Eric Knipp
- Re: [CFCDev] Defining CFC using... Mark Mandel
- Re: [CFCDev] Defining CFC u... Doug Arthur
- Re: [CFCDev] Defining CFC using cfscript Matt Woodward
