Another good reason for doing this would be that Spike's cfcdoc tool
seems to generate it's info from <cffunction> tags, so any functions in
cfscript won't show up.
Nolan Erck wrote:
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
Web Developer/Programmer
Schools Financial Credit Union
(916) 569-5409 Office
(916) 569-2024 Fax
www.schools.org <http://www.schools.org/>
-----Original Message-----
*From:* [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] *On
Behalf Of *Ken
*Sent:* Wednesday, October 26, 2005 2:03 PM
*To:* [email protected]
*Subject:* [CFCDev] CFscript function
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
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject
of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
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.----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject
of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
--
Haikal Saadh, Applications Programmer
Teaching and Learning Support Services
K405, Queensland University of Technology, Kelvin Grove Campus
[EMAIL PROTECTED], 3864 8633
CRICOS No. 00213J
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]