CFLib.org – Common Function Library Project

DayAsString(daynum)

Last updated November 1, 2002
Download UDF

author

Larry Juncker                                     Larry Juncker

Version: 1 | Requires: ColdFusion 5 | Library: DateLib

Description:
Returns a string representation of the numeric day value passed into it.

Return Values:
Returns a string.

Example:

<cfoutput>
Today is the #DayAsString(Day(Now()))#<br>
Today is the #DayAsString(1)#<br>
Today is the #DayAsString(11)#<br>
Today is the #DayAsString(21)#<br>
Today is the #DayAsString(31)#<br>
</cfoutput>

Parameters:

Name Description Required
daynum Day number to convert. Yes

Full UDF Source:

<cfscript>
/**
* Returns a string for a day value.
*
* @param daynum      Day number to convert. (Required)
* @return Returns a string.
* @author Larry Juncker (ljuncker@aljcompserv.com)
* @version 1, November 1, 2002
*/

function dayAsString(daynum) {
var 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";
return ListGetAt(dayList,daynum);
}
</cfscript>

Search CFLib.org


Latest Additions

Jose Diaz-Salcedo Jose Diaz-Salcedo added
cfRssFeed
3 day(s) ago

Raymond Compton Raymond Compton added
structBlend
23 day(s) ago

Duncan Duncan added
IsZIPUK
23 day(s) ago

Todd Sharp Todd Sharp added
getTagContentAll
29 day(s) ago

Gerald Guido Gerald Guido added
ListReturnDuplicat...
1 month(s) ago

Created by Raymond Camden / Design by Justin Johnson