CFLib.org – Common Function Library Project

ChineseZodiac(yyyy)

Last updated December 03, 2001

author

Sierra Bufe

Version: 1 | Requires: CF5 | 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:

/**
 * 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];    
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson