CFLib.org – Common Function Library Project

GetIndependenceDay([TheYear])

Last updated September 10, 2001

author

Ken McCafferty

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns the date for U.S. Independence Day in a given year. If no year is specified, defaults to current year.

Return Values:
Returns a date object.

Example:

<CFOUTPUT>
This year, U.S. Independence Day is on #DateFormat(GetIndependenceDay(), 'dddd, mmm dd, yyyy')#.
</CFOUTPUT>

Parameters:

Name Description Required
TheYear Year you want to return U.S. Independence Day for. No

Full UDF Source:

/**
 * Returns the date for U.S. Independence Day  in a given year.
 * 
 * @param TheYear      Year you want to return U.S. Independence Day for. 
 * @return Returns a date object. 
 * @author Ken McCafferty (mccjdk@yahoo.com) 
 * @version 1.0, September 10, 2001 
 */
// Independence Day: July 4
function GetIndependenceDay() {
    Var TheYear=Year(Now());
      if(ArrayLen(Arguments)) 
        TheYear = Arguments[1];
    return CreateDate(TheYear,7,4);
}

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