CFLib.org – Common Function Library Project

IsWeekend([Date])

Last updated August 17, 2001

author

Raymond Camden

Version: 1 | Requires: CF5 | Library: DateLib

Description:
This function returns true or false depending on if a date falls on the weekend. This is defined as either Saturday or Sunday. The function defaults to today.

Return Values:
Returns a boolean.

Example:

<CFOUTPUT>
Is it the weekend? #IsWeekend()#<BR>
</CFOUTPUT>

Parameters:

Name Description Required
Date Defaults to today. No

Full UDF Source:

/**
 * Returns true if a date is on the weekend.
 * 
 * @param Date 	 Defaults to today. 
 * @return Returns a boolean. 
 * @author Raymond Camden (ray@camdenfamily.com) 
 * @version 1, August 17, 2001 
 */
function IsWeekend() {
	var today = Now();
	if(ArrayLen(Arguments)) today = Arguments[1];
	return (DayOfWeek(today) IS 1 OR DayOfWeek(today) IS 7);
}
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