CFLib.org – Common Function Library Project

MaxDate(dt1, dt2)

Last updated September 12, 2003

author

Shawn Fairweather

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Returns larger of 2 dates.

Return Values:
Returns a date.

Example:

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

Parameters:

Name Description Required
dt1 The first date. (Is always the hardest.) Yes
dt2 The second date. Yes

Full UDF Source:

/**
 * Returns larger of 2 dates.
 * 
 * @param dt1 	 The first date. (Is always the hardest.) (Required)
 * @param dt2 	 The second date. (Required)
 * @return Returns a date. 
 * @author Shawn Fairweather (psalm_119_@hotmail.com) 
 * @version 1, September 12, 2003 
 */
function maxDate(Dt1, Dt2){
     if(DateCompare(Dt1, Dt2) IS 1) return Dt1;
     else return Dt2;
}
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