CFLib.org – Common Function Library Project

GetThanksgivingDay([TheDate])

Last updated September 05, 2001

author

Ken McCafferty

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns the date for Thanksgiving day in a given year. If no year is specified, defaults to current year.

Return Values:
Returns a date object.

Example:

<CFOUTPUT>
This year, Thanksgiving day is on #DateFormat(GetThanksgivingDay(), 'dddd, mmm dd')#.
</CFOUTPUT>

Parameters:

Name Description Required
TheDate The year you want to return Thanksgiving day for. No

Full UDF Source:

/**
 * Returns the date for Thanksgiving day in a given year.
 * This function requires the GetNthOccOfDayInMonth() function available from the DateLib library.
 * 
 * @param TheDate      The year you want to return Thanksgiving day for. 
 * @return Returns a date object. 
 * @author Ken McCafferty (mccjdk@fyi.net) 
 * @version 1.0, September 5, 2001 
 */
// Thanksgiving Day 4th thursday in november
function GetThanksgivingDay() {
  Var TheYear=Year(Now());
  if(ArrayLen(Arguments)) 
    TheYear = Arguments[1];

  return CreateDate(TheYear,11,GetNthOccOfDayInMonth(4,5,11,TheYear));
}

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