CFLib.org – Common Function Library Project

WeekInMonth([theDate])

Last updated September 21, 2004

author

Casey Broich

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns the week number in a month. I.E: The week number of March 27, 2004 would be 4

Return Values:
Returns a number.

Example:

<cfset weekNum = weekInMonth(Now())>

Parameters:

Name Description Required
theDate Date to use. Defaults to now(). No

Full UDF Source:

/**
 * Returns the week number in a month.
 * 
 * @param theDate 	 Date to use. Defaults to now(). (Optional)
 * @return Returns a number. 
 * @author Casey Broich (cab@pagex.com) 
 * @version 1, September 21, 2004 
 */
function weekInMonth() {
  var theDate = Now();
  
  if(arrayLen(arguments)) theDate = arguments[1];
  return  week(theDate) - week(createDate(year(theDate),month(theDate),1)) + 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