RE: DATE TAG
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)#BRBR #DateFormat(DateAdd(D,10,DaytString),MM/DD/)# - #MDYAsString(DateAdd(D,10,DaytString))#BRBR #DateFormat(DateAdd(D,20,DaytString),MM/DD/)# - #MDYAsString(DateAdd(D,20,DaytString))#BRBR #DateFormat(DateAdd(D,30,DaytString),MM/DD/)# - #MDYAsString(DateAdd(D,30,DaytString))#BRBR #DateFormat(DateAdd(D,40,DaytString),MM/DD/)# - #MDYAsString(DateAdd(D,40,DaytString))#BRBR /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
Re: DATE TAG
I did consider it (for about a second) and realized I would never ever have a need for this function, and the tagging and submission would double the development time. =) Thankfully Larry Juncker spruced it and posted it to cflib.org Jerry Johnson [EMAIL PROTECTED] 09/24/02 06:01PM Thanks, you might want to consider wrapping it into a UDF or cf_tag. Thanks again, STEVE At 05:21 PM 9/24/2002 -0400, you wrote: Don't blame me if it doesn't work. Hasn't been tested. The paint is still wet. cfparam name=dateString default=#now()# cfset dayList=First,Second,Third,Fourth,Fifth,Sixth,Seventh,Eighth,Ninth,Tenth,Eleventh,Twelveth,Thirteenth,Fourteenth,Fifteenth,Sixteenth,Seventeenth,Eighteenth,Nineteenth,Twentieth,Twenty First,Twenty Second,Twenty Third,Twenty Fourth,Twenty Fifth,Twenty Sixth,Twenty Seventh,Twenty Eighth,Twenty Ninth,Thirtieth,Thirty First cfset numList=One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen cfset numTenList=Ten,Twenty,Thirty,Fourty,Fifty,Sixty,Seventy,Eighty,Ninety cfset y=year(dateString) cfset m=monthasstring(month(dateString)) cfset d=listGetAt(dayList,day(dateString)) cfset y=right(1+y,4) cfset d1=mid(y,4,1) cfset d2=mid(y,3,1) cfset d3=mid(y,2,1) cfset d4=mid(y,1,1) cfset returnString=The #d# Day of #m#, in the year cfif d4 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d4)# Thousand, ) /cfif cfif d3 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d3)# Hundred, ) /cfif cfif d2 gt 0 or d1 gt 0 cfset returnString=listAppend(returnString,and, ) /cfif cfif d2 eq 1 cfif d2 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d2d1)#, ) /cfif cfelse cfif d2 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numTenList,d2)#, ) /cfif cfif d1 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d1)#, ) /cfif /cfif brbr cfoutput #returnString# /cfoutput [EMAIL PROTECTED] 09/24/02 04:34PM 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 __ Get the mailserver that powers this list at http://www.coolfusion.com FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: DATE TAG
I think you are going to have to write A UDF that uses some cfswitch tags to piece together the output that you would like. cfswitch exprtession=theDay cfcase value=1 cfset dayString = First /cfcase cfcase value=2 cfset dayString = Second /cfcase ... /cfswitch I know it is tedious, but I think it is the simplest way. -- Original Message -- From: Steven A. del Sol [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] Date: Tue, 24 Sep 2002 13:34:08 -0700 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 __ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: DATE TAG
Don't blame me if it doesn't work. Hasn't been tested. The paint is still wet. cfparam name=dateString default=#now()# cfset dayList=First,Second,Third,Fourth,Fifth,Sixth,Seventh,Eighth,Ninth,Tenth,Eleventh,Twelveth,Thirteenth,Fourteenth,Fifteenth,Sixteenth,Seventeenth,Eighteenth,Nineteenth,Twentieth,Twenty First,Twenty Second,Twenty Third,Twenty Fourth,Twenty Fifth,Twenty Sixth,Twenty Seventh,Twenty Eighth,Twenty Ninth,Thirtieth,Thirty First cfset numList=One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen cfset numTenList=Ten,Twenty,Thirty,Fourty,Fifty,Sixty,Seventy,Eighty,Ninety cfset y=year(dateString) cfset m=monthasstring(month(dateString)) cfset d=listGetAt(dayList,day(dateString)) cfset y=right(1+y,4) cfset d1=mid(y,4,1) cfset d2=mid(y,3,1) cfset d3=mid(y,2,1) cfset d4=mid(y,1,1) cfset returnString=The #d# Day of #m#, in the year cfif d4 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d4)# Thousand, ) /cfif cfif d3 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d3)# Hundred, ) /cfif cfif d2 gt 0 or d1 gt 0 cfset returnString=listAppend(returnString,and, ) /cfif cfif d2 eq 1 cfif d2 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d2d1)#, ) /cfif cfelse cfif d2 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numTenList,d2)#, ) /cfif cfif d1 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d1)#, ) /cfif /cfif brbr cfoutput #returnString# /cfoutput [EMAIL PROTECTED] 09/24/02 04:34PM 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 __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
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 __ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: DATE TAG
Thanks, you might want to consider wrapping it into a UDF or cf_tag. Thanks again, STEVE At 05:21 PM 9/24/2002 -0400, you wrote: Don't blame me if it doesn't work. Hasn't been tested. The paint is still wet. cfparam name=dateString default=#now()# cfset dayList=First,Second,Third,Fourth,Fifth,Sixth,Seventh,Eighth,Ninth,Tenth,Eleventh,Twelveth,Thirteenth,Fourteenth,Fifteenth,Sixteenth,Seventeenth,Eighteenth,Nineteenth,Twentieth,Twenty First,Twenty Second,Twenty Third,Twenty Fourth,Twenty Fifth,Twenty Sixth,Twenty Seventh,Twenty Eighth,Twenty Ninth,Thirtieth,Thirty First cfset numList=One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten,Eleven,Twelve,Thirteen,Fourteen,Fifteen,Sixteen,Seventeen,Eighteen,Nineteen cfset numTenList=Ten,Twenty,Thirty,Fourty,Fifty,Sixty,Seventy,Eighty,Ninety cfset y=year(dateString) cfset m=monthasstring(month(dateString)) cfset d=listGetAt(dayList,day(dateString)) cfset y=right(1+y,4) cfset d1=mid(y,4,1) cfset d2=mid(y,3,1) cfset d3=mid(y,2,1) cfset d4=mid(y,1,1) cfset returnString=The #d# Day of #m#, in the year cfif d4 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d4)# Thousand, ) /cfif cfif d3 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d3)# Hundred, ) /cfif cfif d2 gt 0 or d1 gt 0 cfset returnString=listAppend(returnString,and, ) /cfif cfif d2 eq 1 cfif d2 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d2d1)#, ) /cfif cfelse cfif d2 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numTenList,d2)#, ) /cfif cfif d1 gt 0 cfset returnString=listAppend(returnString,#listGetAt(numList,d1)#, ) /cfif /cfif brbr cfoutput #returnString# /cfoutput [EMAIL PROTECTED] 09/24/02 04:34PM 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 __ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists