CFLib.org – Common Function Library Project

ChineseZodiac(yyyy)

Last updated December 3, 2001
Download UDF

author

Sierra Bufe                                       Sierra Bufe

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

Description:
Returns the Chinese Zodiac animal corresponding to the given year of birth. Takes any year, positive or negative. All years will be taken at face value, for example 73 will be the year 73 A.D., not 1973.

Return Values:
Returns a string.

Example:

<cfoutput>
ChineseZodiac(69) = #ChineseZodiac(69)#<br>
ChineseZodiac(1969) = #ChineseZodiac(1969)#<br>
ChineseZodiac(1973) = #ChineseZodiac(1973)#<br>
ChineseZodiac(1976) = #ChineseZodiac(1976)#<br>
ChineseZodiac(-1200) = #ChineseZodiac(-1200)#<br>
</cfoutput>

Parameters:

Name Description Required
yyyy Year (in the format yyyy) you want the Chinese Zodiac animal for. Yes

Full UDF Source:

<cfscript>
/**
* Returns the Chinese Zodiac animal corresponding to the given year of birth.
*
* @param yyyy      Year (in the format yyyy) you want the Chinese Zodiac animal for.
* @return Returns a string.
* @author Sierra Bufe (sierra@brighterfusion.com)
* @version 1, December 3, 2001
*/

function ChineseZodiac(yyyy) {
var Animals = ListToArray("Monkey,Chicken,Dog,Pig,Mouse,Ox,Tiger,Rabbit,Dragon,Snake,Horse,Sheep");
return Animals[(yyyy MOD 12) + 1];    
}
</cfscript>

Search CFLib.org


Latest Additions

Jose Diaz-Salcedo Jose Diaz-Salcedo added
cfRssFeed
2 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