CFLib.org – Common Function Library Project

listMaxDate(dtList[, delim])

Last updated January 17, 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;
}

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