CFLib.org – Common Function Library Project

GetFederalFiscalYear([date])

Last updated July 2, 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));
 }
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson