Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<cffunction name="colorPick">
<cfargument name="theDate" type="date" required="true">
<cfset var colors = ["red","blue","green","yellow","orange"]>
<cfset var index = 1/>
<!--- Convert the date to Unix timestamp and mod by the len of the color aray --->
<cfset index = (DateDiff("d","1/1/1970",arguments.theDate) MOD arraylen(colors)) + 1/>
<cfreturn colors[index]/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment