CFLib.org – Common Function Library Project

GetMothersDay([TheYear])

Last updated August 22, 2001

author

Ken McCafferty

Version: 1 | Requires: CF5 | Library: DateLib

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

Return Values:
Returns a date object.

Example:

<CFOUTPUT>
This year, Mother's Day is on #DateFormat(GetMothersDay(), 'dddd, mmm dd')#.
</CFOUTPUT>

Parameters:

Name Description Required
TheYear The year you want to return Mother's Day for. No

Full UDF Source:

/**
 * Returns a date for Mother's day in a given year.  If no year is specified, defaults to the current year.
 * This function requires the GetNthOccOfDayInMonth() function available from the DateLib library. Minor modifications by Rob Brooks-Bilson (rbils@amkor.com)
 * 
 * @param TheYear 	 The year you want to return Mother's Day for. 
 * @return Returns a date object. 
 * @author Ken McCafferty (mccjdk@yahoo.com) 
 * @version 1.0, August 22, 2001 
 */
//Mother's:second sunday in may
function GetMothersDay()
{
  Var TheYear=Year(Now());
  if(ArrayLen(Arguments)) 
    TheYear = Arguments[1];
  return CreateDate(TheYear,5,GetNthOccOfDayInMonth(2,1,5,TheYear));
}
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