Hi Folks,
Since it's the first day of the new federal fiscal year, and I needed this
anyway, I just wrote a quick udf to return the current fiscal year. Here it
is for anyone else that works for the government and might want it:

<cfscript>
/**
 * Returns the federal fiscal year.
 *
 * @param DateTime   Date/time object you want tested. Defaults to now().
 * @return Returns a numeric value.
 * @author Deanna Schneider ([EMAIL PROTECTED])
 * @version 1, July 1, 2002
 */
function GetFiscalYear() {
 var datetime = 0;
 var month = 0;
 if (ArrayLen(Arguments) is 0) {
  datetime = Now();
  month = month(datetime);
 }
 else {
  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));
  }
}
</cfscript>

Of course, updates/additions welcomed. I thought about making the definition
of fiscal year as a parameter, but I haven't gotten around to it, since I
don't need that.

-Deanna



Deanna Schneider
Interactive Media Developer
[EMAIL PROTECTED]


______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to