CFLib.org – Common Function Library Project

GetFederalFiscalYear([date])

Last updated July 02, 2002

author

Deanna Schneider

Version: 1 | Requires: CF5 | Library: DateLib

Description:
The Federal Fiscal year returned is the current year if the passed in date is before July 1, next year if after July 1. Defaults to current date if none is provided or if something other than a date is provided.

Return Values:
Returns a numeric value.

Example:

<cfoutput>
#GetFederalFiscalYear()#<br>
#GetFederalFiscalYear("6/1/02")#
</cfoutput>

Parameters:

Name Description Required
date Date to return the Federal Fiscal Year for. Defaults to the current date. No

Full UDF Source:

/**
 * Returns the Federal Fiscal Year for a given date.
 * 
 * @param date      Date to return the Federal Fiscal Year for.  Defaults to the current date. (Optional)
 * @return Returns a numeric value. 
 * @author Deanna Schneider (deanna.schneider@ces.uwex.edu) 
 * @version 1, July 2, 2002 
 */
function GetFederalFiscalYear() {
       var datetime = now();
       var month = month(datetime);
       if (ArrayLen(Arguments) gte 1) {
             if (IsDate(Arguments[1])) {
                   datetime = Arguments[1];
                   month = month(datetime);
             } else datetime = Now();
       }
       if (listfind("1,2,3,4,5,6", month)) 
         return Year(datetime);
       else 
         return  Year(DateAdd('yyyy', 1, datetime));
 }

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

Created by Raymond Camden / Design by Justin Johnson