home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / progmisc / nfsrc21.zip / LASTDAY.PRG < prev    next >
Text File  |  1991-08-16  |  2KB  |  69 lines

  1. /*
  2.  * File......: LASTDAY.PRG
  3.  * Author....: Mike Schinkel
  4.  * Date......: $Date:   15 Aug 1991 23:02:32  $
  5.  * Revision..: $Revision:   1.1  $
  6.  * Log file..: $Logfile:   E:/nanfor/src/lastday.prv  $
  7.  * 
  8.  * This is an original work by Mike Schinkel and is placed in the
  9.  * public domain.
  10.  *
  11.  * Modification history:
  12.  * ---------------------
  13.  *
  14.  * $Log:   E:/nanfor/src/lastday.prv  $
  15.  * 
  16.  *    Rev 1.1   15 Aug 1991 23:02:32   GLENN
  17.  * Forest Belt proofread/edited/cleaned up doc
  18.  * 
  19.  *    Rev 1.0   14 Jun 1991 04:24:04   GLENN
  20.  * Initial revision.
  21.  * 
  22.  *
  23.  */
  24.  
  25.  
  26.  /* Librarian's note:  The toolkit's original ft_lday() function was
  27.     submitted by Jeff Bryant.  Mike saw it and optimized it.  Thanks
  28.     to you both for your great code!
  29.  
  30.   */
  31.  
  32. /*  $DOC$
  33.  *  $FUNCNAME$
  34.  *     FT_LDAY()
  35.  *  $CATEGORY$
  36.  *     Date/Time
  37.  *  $ONELINER$
  38.  *     Return last day of the month
  39.  *  $SYNTAX$
  40.  *     FT_LDAY( [ <dDateToChk> ] ) -> dLastDay
  41.  *  $ARGUMENTS$
  42.  *     <dDateToChk> is a date within a month for which you want to find
  43.  *     the last date of that month.  If not passed or is an incorrect
  44.  *     type, defaults to current system date.
  45.  *  $RETURNS$
  46.  *     A Clipper date value representing the last date of the month.
  47.  *  $DESCRIPTION$
  48.  *     This function will return the last day of the month of the date
  49.  *     passed, or the last day of the current month if no argument is
  50.  *     supplied.
  51.  *  $EXAMPLES$
  52.  *     dDate := CTOD( "09/15/90" )
  53.  *     ? FT_LDAY( dDate )             // 09/30/90
  54.  *     ? FT_LDAY()                    // 03/31/91  (current month)
  55.  *  $SEEALSO$
  56.  *     FT_FDAY()
  57.  *  $END$
  58.  */
  59.  
  60. FUNCTION ft_lday( dDate )
  61.    LOCAL d:= dDate
  62.    IF dDate == NIL
  63.       d:= Date()
  64.    ENDIF
  65.    RETURN ( d+= 45 - Day( d ) ) - Day( d )
  66.  
  67.  
  68.  
  69.