Community |
decade()Function that returns the decade (xxx0-xxx9) to which the specified year belongs. <--- Function that returns the decade (xxx0-xxx9) to which the specified year belongs. @param year Year to use. (Required) @return Returns a string. @author Mosh Teitelbaum @version 1, July 27, 2012 ---> <cffunction name="decade" returntype="string" output="no"> <cfargument name="year" type="numeric" required="yes"> <cfset var startYear = arguments.year - (arguments.year MOD 10)> <cfset var endYear = arguments.year + (10 - (arguments.year MOD 10) - 1)> <cfreturn startYear & "-" endYear> </cffunction> This UDF is also available from cflib.org at http://www.cflib.org/udf/decade. |