getFirstDateThisQuarter()
Last updated August 11, 2005
Version: 1 | Requires: ColdFusion 5 | 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:
Parameters:
No arguments.
Full UDF Source:
<cfscript>
/**
* 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);
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
2 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)