lastDayofWeek([date])
Last updated August 30, 2010
Version: 1 | Requires: CF5 | Library: DateLib
Description:
This function will return the next Saturday after the date you pass in.
Return Values:
Returns a date.
Example:
<cfoutput>
#lastDayOfWeek()#<br/>
#lastDayOfWeek(now())#<br/>
#lastDayOfWeek(dateAdd("ww", 1, now()))#
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
date | Date to base 'next Saturday' on. Defaults to now(). | No |
Full UDF Source:
/**
* Returns last day of the week, assumes Saturday is the last day.
* Modded by RCamden to support default date
*
* @param date Date to base 'next Saturday' on. Defaults to now(). (Optional)
* @return Returns a date.
* @author Randy Johnson (randy@cfconcepts.com)
* @version 1, August 30, 2010
*/
function lastDayOfWeek() {
var NumberOfDays="";
var LastDayOfWeek = "";
if(arrayLen(arguments) is 0) arguments.date = now();
else arguments.date = arguments[1];
date = trim(arguments.date);
NumberOfDays = 7 - dayOfWeek(date);
LastDayOfWeek = dateAdd("d", NumberOfDays, date);
return LastDayOfWeek;
}
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