CFLib.org – Common Function Library Project

getFirstDateThisQuarter()

Last updated August 11, 2005
Download UDF

author

Scott Glassbrook                                  Scott Glassbrook

Version: 1 | Requires: ColdFusion 5 | Library: DateLib

 
Rated 0 time(s). Average Rating: 0

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:

<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 Shawn Porter added
DeMoronize
2 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson