GetLastDateinQuarter(quarter)
Last updated February 14, 2004
Version: 1 | Requires: CF5 | Library: DateLib
Description:
Gets the last date in a given quarter.
Return Values:
Returna a date.
Example:
<cfloop index="x" from=1 to=4>
<cfoutput>#getLastDateInQuarter(x)# = #quarter(getLastDateInQuarter(x))#<br></cfoutput>
</cfloop>
Parameters:
Name | Description | Required |
---|---|---|
quarter | A number from 1 to 4. | Yes |
Full UDF Source:
/**
* Gets the last date in a given quarter.
*
* @param quarter A number from 1 to 4. (Required)
* @return Returna a date.
* @author Brian Sweeney (brianvsweeney@hotmail.com)
* @version 1, February 14, 2004
*/
function GetLastDateinQuarter(quarter){
switch(quarter){
case 1:
return CreateDate(year(now()), 3, DaysInMonth(CreateDate(year(now()),3,1)));
break;
case 2:
return CreateDate(year(now()), 6, DaysInMonth(CreateDate(year(now()),6,1)));
break;
case 3:
return CreateDate(year(now()), 9, DaysInMonth(CreateDate(year(now()),9,1)));
break;
case 4:
return CreateDate(year(now()), 12, DaysInMonth(CreateDate(year(now()),12,1)));
break;
}
}
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