CFLib.org – Common Function Library Project

MinDate(dt1, dt2)

Last updated September 12, 2003

author

Shawn Fairweather

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns smaller of 2 dates.

Return Values:
Returns a date.

Example:

<cfset d1 = createDate(2002,1,1)>
<cfset d2 = now()>
<cfoutput>#minDate(d1,d2)#</cfoutput>

Parameters:

Name Description Required
dt1 First date. Yes
dt2 Second date. Yes

Full UDF Source:

/**
 * Returns smaller of 2 dates.
 * 
 * @param dt1      First date. (Required)
 * @param dt2      Second date. (Required)
 * @return Returns a date. 
 * @author Shawn Fairweather (psalm_119_@hotmail.com) 
 * @version 1, September 12, 2003 
 */
function minDate(Dt1, Dt2){
     if(DateCompare(Dt2, Dt1) IS 1) return Dt1;
     else return Dt2;
}

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