I rewrote this into a UDF last night called MDYAsString and submitted it to
cflib along with DayAsString and YearAsString

I will include them below:

<cfscript>
/**
 * Returns an String representation of the day passed into it.
 *
 * @return Returns a string.
 * @author Larry Juncker ([EMAIL PROTECTED])
 * @version 1, September 24, 2002
 */
        function dayAsString(daynum)
        {
                var
dayList="First,Second,Third,Fourth,Fifth,Sixth,Seventh,Eighth,Ninth,Tenth,El
eventh,Twelveth,Thirteenth,Fourteenth,Fifteenth,Sixteenth,Seventeenth,Eighte
enth,Nineteenth,Twentieth,Twenty First,Twenty Second,Twenty Third,Twenty
Fourth,Twenty Fifth,Twenty Sixth,Twenty Seventh,Twenty Eighth,Twenty
Ninth,Thirtieth,Thirty First";
                var DayAsString = ListGetAt(dayList,daynum);

                 return DayAsString;
        }
</cfscript>

<cfscript>
/**
 * Returns a String representation of the Year passed into it.
 *
 * @return Returns a stringvalue for aNumeric year.
 * @author Larry Juncker ([EMAIL PROTECTED])
 * @version 1, September 24, 2002
 */
        function YearAsString(yearnum)
        {
                var
numTenList="Ten,Twenty,Thirty,Fourty,Fifty,Sixty,Seventy,Eighty,Ninety";
                var
numList="One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thir
teen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen";
                var y1=mid(yearnum,1,1);
                var y2=mid(yearnum,2,1);
                var y3=mid(yearnum,3,1);
                var y4=mid(yearnum,4,1);
                var y2Str = '';
                var y3Str = '';

                if(y2 gt 0) y2Str = ListGetAt(numList,y2) & " Hundred";
                if(y3 gt 0) y3Str = ListGetAt(numTenList,y3);

                YAS = ListGetAt(numList,y1) & " Thousand "   & y2Str & " " &  " and " &
y3Str & " " & ListGetAt(numList,y4);

                 return YAS;
        }
</cfscript>

And then the Grandaddy -

<cfscript>
        /**
 * Returns an String representation of the day passed into it.
 *
 * @input provide a date
 * @return Returns a string.
 * @author Larry Juncker ([EMAIL PROTECTED])
 * @version 1, September 24, 2002
 */
 function MDYAsString(daytString)
        {
                var
dayList="First,Second,Third,Fourth,Fifth,Sixth,Seventh,Eighth,Ninth,Tenth,El
eventh,Twelveth,Thirteenth,Fourteenth,Fifteenth,Sixteenth,Seventeenth,Eighte
enth,Nineteenth,Twentieth,Twenty First,Twenty Second,Twenty Third,Twenty
Fourth,Twenty Fifth,Twenty Sixth,Twenty Seventh,Twenty Eighth,Twenty
Ninth,Thirtieth,Thirty First";
                var DayAsString = ListGetAt(dayList,Day(DaytString));

                var
numTenList="Ten,Twenty,Thirty,Fourty,Fifty,Sixty,Seventy,Eighty,Ninety";
                var
numList="One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thir
teen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen";
                var y1=mid(Year(DaytString),1,1);
                var y2=mid(Year(DaytString),2,1);
                var y3=mid(Year(DaytString),3,1);
                var y4=mid(Year(DaytString),4,1);
                var y2Str = '';
                var y3Str = '';

                if(y2 gt 0) y2Str = ListGetAt(numList,y2) & " Hundred";
                if(y3 gt 0) y3Str = ListGetAt(numTenList,y3);

                YAS = "The " & DayAsString & " day of " & 
MonthAsString(Month(DaytString))
& ", in the year " & ListGetAt(numList,y1) & " Thousand "   & y2Str & " " &
" and " & y3Str & " " & ListGetAt(numList,y4);

                 return YAS;
        }
</cfscript>

<cfoutput>
<cfset DaytString = "9/02/1986">

#DaytString# - #MDYAsString(DaytString)#<BR><BR>
#DateFormat(DateAdd("D","10",DaytString),"MM/DD/YYYY")# -
#MDYAsString(DateAdd("D","10",DaytString))#<BR><BR>
#DateFormat(DateAdd("D","20",DaytString),"MM/DD/YYYY")# -
#MDYAsString(DateAdd("D","20",DaytString))#<BR><BR>
#DateFormat(DateAdd("D","30",DaytString),"MM/DD/YYYY")# -
#MDYAsString(DateAdd("D","30",DaytString))#<BR><BR>
#DateFormat(DateAdd("D","40",DaytString),"MM/DD/YYYY")# -
#MDYAsString(DateAdd("D","40",DaytString))#<BR><BR>
</cfoutput>

Hope these help

Larry Juncker
Senior Cold fusion Developer
Heartland Communications Group, Inc.
[EMAIL PROTECTED]
(515) 574-2122

CONFIDENTIALITY NOTICE
The information contained in this e-mail is intended only for the use of the
individual or entity to which it is addressed.  This e-mail may contain
information that is privileged, confidential and/or personal.  If the reader
of this message is not the intended recipient (or the employee or agent
responsible to deliver it to the intended recipient), you are hereby
notified that any dissemination, distribution, or copying of this
communication is prohibited.

If you have received this communication in error, please notify us at the
e-mail listed above.

-----Original Message-----
From: Larry Juncker [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 4:25 PM
To: CF-Talk
Subject: RE: DATE TAG


Try this - A bit long but it works:
<cfswitch expression="#Day(Now())#">
        <cfcase value="1">
                <cfset dayAsString = "First">
        </cfcase>
        <cfcase value="2">
                <cfset dayAsString = "Second">
        </cfcase>

        <cfcase value="3">
                <cfset dayAsString = "Third">
        </cfcase>

        <cfcase value="4">
                <cfset dayAsString = "Fourth">
        </cfcase>

        <cfcase value="5">
                <cfset dayAsString = "Fifth">
        </cfcase>

        <cfcase value="6">
                <cfset dayAsString = "Sixth">
        </cfcase>

        <cfcase value="7">
                <cfset dayAsString = "Seventh">
        </cfcase>

        <cfcase value="8">
                <cfset dayAsString = "Eighth">
        </cfcase>

        <cfcase value="9">
                <cfset dayAsString = "Ninth">
        </cfcase>

        <cfcase value="10">
                <cfset dayAsString = "Tenth">
        </cfcase>

        <cfcase value="11">
                <cfset dayAsString = "Eleventh">
        </cfcase>

        <cfcase value="12">
                <cfset dayAsString = "Twelfth">
        </cfcase>

        <cfcase value="13">
                <cfset dayAsString = "Thirteenth">
        </cfcase>

        <cfcase value="14">
                <cfset dayAsString = "Fourteenth">
        </cfcase>

        <cfcase value="15">
                <cfset dayAsString = "Fifteenth">
        </cfcase>

        <cfcase value="16">
                <cfset dayAsString = "Sixteenth">
        </cfcase>

        <cfcase value="17">
                <cfset dayAsString = "Seventeenth">
        </cfcase>

        <cfcase value="18">
                <cfset dayAsString = "Eighteenth">
        </cfcase>

        <cfcase value="19">
                <cfset dayAsString = "Nineteenth">
        </cfcase>

        <cfcase value="20">
                <cfset dayAsString = "Twentieth">
        </cfcase>

        <cfcase value="21">
                <cfset dayAsString = "Twenty First">
        </cfcase>

        <cfcase value="22">
                <cfset dayAsString = "Twenty Second">
        </cfcase>

        <cfcase value="23">
                <cfset dayAsString = "Twenty Third">
        </cfcase>

        <cfcase value="24">
                <cfset dayAsString = "Twenty Fourth">
        </cfcase>

        <cfcase value="25">
                <cfset dayAsString = "Twenty Fifth">
        </cfcase>

        <cfcase value="26">
                <cfset dayAsString = "Twenty Sixth">
        </cfcase>

        <cfcase value="27">
                <cfset dayAsString = "Twenty Seventh">
        </cfcase>

        <cfcase value="28">
                <cfset dayAsString = "Twenty Eighth">
        </cfcase>

        <cfcase value="29">
                <cfset dayAsString = "Twenty Ninth">
        </cfcase>

        <cfcase value="30">
                <cfset dayAsString = "Thirtieth">
        </cfcase>

        <cfcase value="31">
                <cfset dayAsString = "Thirty First">
        </cfcase>

</cfswitch>

<cfswitch expression="#Year(Now())#">
        <cfcase value="2002">
                <cfset YearAsString = "Two Thousand and Two">
        </cfcase>
</cfswitch>

<HR>
<cfoutput>
The #DayAsString# Day of #MonthAsString(Month(Now()))# in the year
#YearAsString#
</cfoutput>

Larry Juncker
Senior Cold fusion Developer
Heartland Communications Group, Inc.
[EMAIL PROTECTED]
(515) 574-2122

CONFIDENTIALITY NOTICE
The information contained in this e-mail is intended only for the use of the
individual or entity to which it is addressed.  This e-mail may contain
information that is privileged, confidential and/or personal.  If the reader
of this message is not the intended recipient (or the employee or agent
responsible to deliver it to the intended recipient), you are hereby
notified that any dissemination, distribution, or copying of this
communication is prohibited.

If you have received this communication in error, please notify us at the
e-mail listed above.

-----Original Message-----
From: Steven A. del Sol [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 3:34 PM
To: CF-Talk
Subject: DATE TAG


Has anyone seen a tag or know of a way to get CF to produce the date in the
following format:

09/22/2002 would read......The Twenty Second day of September, in the year
Two Thousand and Two.



Steve



______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to