CFLib.org – Common Function Library Project

ChineseZodiac(yyyy)

Last updated December 3, 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];	
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson