CFLib.org – Common Function Library Project

listMinDate(dtList[, delim])

Last updated January 16, 2007

author

Ann Terrell

Version: 2 | Requires: CF5 | Library: StrLib

Description:
Checks a list of dates for the minimum date.

Return Values:
Returns a date.

Example:

<cfoutput>
##listMinDate("1/1/2000,2/4/2003,5/23/1999,4/3/1600,5/6/2004")##: <br>
#listMinDate("1/1/2000,2/4/2003,5/23/1999,4/3/1600,5/6/2004")#
</cfoutput>

Parameters:

Name Description Required
dtList List to search. Yes
delim Delimiter to use. Defaults to a comma. No

Full UDF Source:

/**
 * Checks a list of dates for the minimum date.
 * v2 by Steven Van Gemert
 * 
 * @param dtList 	 List to search. (Required)
 * @param delim 	 Delimiter to use. Defaults to a comma. (Optional)
 * @return Returns a date. 
 * @author Ann Terrell (ann@landuseoregon.com) 
 * @version 2, January 16, 2007 
 */
function listMinDate(ThisDateList) {
	var ThisDelimiter = ",";
	var ThisDateListLength = "";
	var ThisMinDate = "";
	var i = "";
  
	if(arrayLen(arguments) GTE 2) ThisDelimiter = Arguments[2];

	ThisDateListLength = ListLen(ThisDateList, ThisDelimiter);
	ThisMinDate = ListFirst(ThisDateList, ThisDelimiter);
  
	for (i=1; i LTE ThisDateListLength; i=i+1){
 		if(DateCompare(ListGetAt(ThisDateList, i, ThisDelimiter), ThisMinDate) IS -1) {
			ThisMinDate = ListGetAt(ThisDateList, i, ThisDelimiter);
	   	}
	  }
  
	return ThisMinDate;
}
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