Skip to content

Instantly share code, notes, and snippets.

@dannyrscott
Last active December 14, 2015 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dannyrscott/5064455 to your computer and use it in GitHub Desktop.
Save dannyrscott/5064455 to your computer and use it in GitHub Desktop.
<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]/>
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment