getFirstDateThisQuarter()
Last updated August 11, 2005
Version: 1 | Requires: CF5 | Library: DateLib
Description:
This function returns a datetime string of the first date of the current quarter, using the Now() function.
Return Values:
Returns a date.
Example:
<cfoutput>#getFirstDateThisQuarter()#</cfoutput>
Parameters:
No arguments.
Full UDF Source:
/**
* Returns a date object with the first date of the current quarter.
*
* @return Returns a date.
* @author Scott Glassbrook (cflib@vox.phydiux.com)
* @version 1, August 11, 2005
*/
function getFirstDateThisQuarter() {
if(now() gte createDateTime(DatePart("yyyy", now()), 01, 01, 00, 00, 00) and now() lte createDateTime(DatePart("yyyy", now()), 03, 31, 23, 59, 59)) return createDate(datePart("yyyy", now()), 01, 01);
else if (now() gte createDateTime(DatePart("yyyy", now()), 04, 01, 00, 00, 00) and now() lte createDateTime(DatePart("yyyy", now()), 06, 30, 23, 59, 59)) return createDate(datePart("yyyy", now()), 04, 01);
else if (now() gte createDateTime(DatePart("yyyy", now()), 07, 01, 00, 00, 00) and now() lte createDateTime(DatePart("yyyy", now()), 09, 30, 23, 59, 59)) return createDate(datePart("yyyy", now()), 07, 01);
else return createDate(datePart("yyyy", now()), 10, 01);
}
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