CFLib.org – Common Function Library Project

DayAsString(daynum)

Last updated November 1, 2002

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

 
Rated 1 time(s). Average Rating: 4.0

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

Return Values:
Returns a string.

Example:

view plain print about
<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:

view plain print about
<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>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Dave Anderson Dave Anderson added
iniToStruct
20 day(s) ago

Dave Anderson Dave Anderson added
deDupeArray
20 day(s) ago

Richard Richard added
dice
22 day(s) ago

Isaac Dealey Isaac Dealey added
getRelative
a while ago

Top Rated

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 22 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Raymond Camden highlightAndCrop
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson