getCurrentGradYear(switchmonth)
Last updated March 30, 2006
Version: 1 | Requires: CF5 | Library: DateLib
Description:
Returns the current graduation year/end of school year (returns -1 on an error). Useful for determining which school year we are currently in as opposed to which fiscal year. Uses the now(), Month(), and Year() functions.
Return Values:
Returns a number.
Example:
<cfoutput>#getcurrentGradYear(9)#</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
switchmonth | Numeric value for the first month of the school year. | Yes |
Full UDF Source:
<!---
Gets the current graduation year/end of school year.
@param switchmonth Numeric value for the first month of the school year. (Required)
@return Returns a number.
@author Lisa D. Brown (wertle@wertle.com)
@version 1, April 9, 2007
--->
<cffunction name="getCurrentGradYear" returntype="numeric">
<!---last month of a schoolyear--->
<cfargument name="switchmonth" type="numeric" required="no" default="6">
<cfset var currGradYear = -1>
<!---if the current month is between January and the last month of the schoolyear,
set the current graduation year to the current year--->
<cfif month(now()) gte 1 and month(now()) lte arguments.switchmonth>
<cfset currGradYear = year(now())>
<!---if the current month is between the first month of the schoolyear and December,
set the current graduation year to be next year--->
<cfelseif month(now()) gt arguments.switchmonth and month(now()) lte 12>
<cfset currGradYear = year(now()) + 1>
</cfif>
<cfreturn currGradYear>
</cffunction>
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016