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;
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson