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

  1. /*
  2.  * File......: FIRSTDAY.PRG
  3.  * Author....: Jeff Bryant
  4.  * Date......: $Date:   15 Aug 1991 23:03:38  $
  5.  * Revision..: $Revision:   1.2  $
  6.  * Log file..: $Logfile:   E:/nanfor/src/firstday.prv  $
  7.  * 
  8.  * This function is an original work by Jeff Bryant and is placed in the
  9.  * public domain.
  10.  *
  11.  * Modification history:
  12.  * ---------------------
  13.  *
  14.  * $Log:   E:/nanfor/src/firstday.prv  $
  15.  * 
  16.  *    Rev 1.2   15 Aug 1991 23:03:38   GLENN
  17.  * Forest Belt proofread/edited/cleaned up doc
  18.  * 
  19.  *    Rev 1.1   14 Jun 1991 19:51:54   GLENN
  20.  * Minor edit to file header
  21.  * 
  22.  *    Rev 1.0   01 Apr 1991 01:01:24   GLENN
  23.  * Nanforum Toolkit
  24.  *
  25.  */
  26.  
  27.  
  28. /*  $DOC$
  29.  *  $FUNCNAME$
  30.  *     FT_FDAY()
  31.  *  $CATEGORY$
  32.  *     Date/Time
  33.  *  $ONELINER$
  34.  *     Return first day of the month
  35.  *  $SYNTAX$
  36.  *     FT_FDAY( [ <dDateToChk> ] ) -> dFirstDay
  37.  *  $ARGUMENTS$
  38.  *     <dDateToChk> is a date within a month for which you want to find
  39.  *     the first date of that month.  If not passed or is an incorrect type,
  40.  *     defaults to current system date.
  41.  *  $RETURNS$
  42.  *     A Clipper date value representing the first date of the month.
  43.  *  $DESCRIPTION$
  44.  *     This function will return the first day of the month of the date
  45.  *     passed, or the first day of the current month if no argument is
  46.  *     supplied.
  47.  *  $EXAMPLES$
  48.  *     dDate := CTOD( "09/15/90" )
  49.  *     ? FT_FDAY( dDate )             // 09/01/90
  50.  *     ? FT_FDAY()                    // 03/01/91  (current month)
  51.  *  $SEEALSO$
  52.  *     FT_LDAY()
  53.  *  $END$
  54.  */
  55.  
  56. FUNCTION FT_FDAY(dDateToChk)
  57.  
  58.    IF Valtype(dDatetoChk) # "D"
  59.       dDatetoChk := Date()
  60.    ENDIF
  61.  
  62.    RETURN dDateToChk - (DAY(dDateToChk)-1)
  63.  
  64.