home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST19.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  989 b   |  46 lines

  1. ********************
  2.  
  3. FUNCTION Long_date
  4.  
  5.    PARAMETERS _array, _oldest
  6.  
  7.    PRIVATE _the_ret_val, _the_element
  8.  
  9.    IF PCOUNT() = 0
  10.       RETURN(-1)
  11.    ELSEIF PCOUNT() = 1
  12.       _oldest = .T.
  13.    ELSEIF TYPE("_array") != "A"
  14.       RETURN(-1)
  15.    ENDIF
  16.  
  17.    * This function returns the oldest, or the youngest date element
  18.    * in the given array
  19.  
  20.    _the_ret_val = 0
  21.    IF _oldest
  22.       _the_element = CTOD("  /  /  ")
  23.    ELSE
  24.       _the_element = CTOD("12/31/99")
  25.    ENDIF
  26.  
  27.    FOR _downtoit = 1 TO LEN(_array)
  28.       d_type = _array[_downtoit]
  29.       IF TYPE("d_type") = "D"
  30.          IF _oldest
  31.             IF d_type > _the_element
  32.                _the_element = d_type
  33.                _the_ret_val = _downtoit
  34.             ENDIF
  35.          ELSE
  36.             IF d_type <= _the_element
  37.                _the_element = d_type
  38.                _the_ret_val = _downtoit
  39.             ENDIF
  40.          ENDIF
  41.       ENDIF
  42.    NEXT
  43.    RETURN(_the_ret_val)
  44.  
  45. * End of File
  46.