CFLib.org – Common Function Library Project

ChineseZodiac(yyyy)

Last updated December 3, 2001

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

 
Rated 0 time(s). Average Rating: 0

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:

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

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

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
30 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

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

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson