CFLib.org – Common Function Library Project

getDaysInQuarter()

Last updated November 13, 2015

author

Sebastiaan Naafs - van Dijk

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns the number of days in the current quarter.

Return Values:
Returns a number.

Example:

writeoutput("Days in this quarter: " & getDaysInQuarter());

Parameters:

No arguments.

Full UDF Source:

/**
 * Returns the number of days in the current quarter.
 * 
 * @return Returns a number. 
 * @author Sebastiaan Naafs - van Dijk (sebastiaan@onlinebase.nl) 
 * @version 1, November 13, 2015 
 */
function getDaysInQuarter() {
    var firstDayOfQuarter = createDate(year(now()),(quarter(now())-1)*3 + 1,1);
    var lastDayOfQuarter = dateAdd("d",-1,dateAdd("m",3,firstDayOfQuarter));
    return dateDiff("d",firstDayOfQuarter,lastDayOfQuarter) + 1;
}

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

Created by Raymond Camden / Design by Justin Johnson