CFLib.org – Common Function Library Project

listMaxDate(dtList[, delim])

Last updated January 16, 2007

author

Ann Terrell

Version: 2 | Requires: CF5 | Library: StrLib

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

Return Values:
Returns a date if at least one found, or returns an empty string.

Example:

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

Parameters:

Name Description Required
dtList List to check. Yes
delim List delimeter. Defaults to a comma. No

Full UDF Source:

/**
 * Checks a list of dates for the maximum date.
 * v2 by Steven Van Gemert
 * 
 * @param dtList 	 List to check. (Required)
 * @param delim 	 List delimeter. Defaults to a comma. (Optional)
 * @return Returns a date if at least one found, or returns an empty string. 
 * @author Ann Terrell (ann@landuseoregon.com) 
 * @version 2, January 16, 2007 
 */
function listMaxDate(ThisDateList) {
	var ThisDelimiter = ",";
	var ThisDateListLength = "";
	var ThisMaxDate = "";
	var i = "";
  
	if(ArrayLen(Arguments) GTE 2) ThisDelimiter = Arguments[2];
  
	ThisDateListLength = ListLen(ThisDateList, ThisDelimiter);
	ThisMaxDate = ListFirst(ThisDateList, ThisDelimiter);
  
	for (i=1; i LTE ThisDateListLength; i=i+1){
		if(DateCompare(ThisMaxDate,  ListGetAt(ThisDateList, i, ThisDelimiter)) IS -1) {
			ThisMaxDate = ListGetAt(ThisDateList, i, ThisDelimiter);
		}
	}
  
	return ThisMaxDate;
}
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