CFLib.org – Common Function Library Project

listMinDate(dtList[, delim])

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

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