CFLib.org – Common Function Library Project

GetInaugurationDay([TheYear])

Last updated August 28, 2001

author

Ken McCafferty

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns a date for the US Presidential Inauguration. Returns -1 for non-inauguration years. If no year is specified, defaults to the current year.

Return Values:
Returns a date object.

Example:

<CFIF GetInaugurationDay() EQ -1>
There are no elections this year, therefore there is no Inauguration Day.
<CFELSE>
<CFOUTPUT>
This year, Inauguration Day is on #DateFormat(GetInaugurationDay(), 'dddd, mmm dd')#.
</CFOUTPUT>
</CFIF>

Parameters:

Name Description Required
TheYear The year you want to return Inauguration Day for. No

Full UDF Source:

/**
 * Returns the date for Inauguration Day
 * Minor modifications by Rob Brooks-Bilson
 * 
 * @param TheYear      The year you want to return Inauguration Day for. 
 * @return Returns a date object. 
 * @author Ken McCafferty (mccjdk@yahoo.com) 
 * @version 1, August 28, 2001 
 */
//Inauguration Day: Jan 20, every 4 years ,2001,2005 etc. If Jan 20 is Sunday, InaugurationDay is Jan 21
// for other  years, -1 is returned
function GetInaugurationDay() 
{
  Var TheYear=Year(Now());
  if(ArrayLen(Arguments)) 
    TheYear = Arguments[1];
  if(TheYear MOD 4 eq 1){ 
    if(DayOfWeek(CreateDate(TheYear,1,20)) eq 1){  //Sunday
      return CreateDate(TheYear,1,21);
    }
    else{
      return CreateDate(TheYear,1,20);
    }
  } 
  else{
    return -1;
  }
}

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