SP Date Functions

 DATECALC()     Adds/subtracts days,weeks,months,years to a date
 DTOW()         Converts date to words
 STOD()         Returns date from string in the form YYYYMMDD
 WOYEAR()       Calculates week of the year (# of 7 day periods)
 DTDIFF()       Returns difference between dates
 DAYSIN()       Calculates number of days in a month
 BOYEAR()       Determine beginning of year a date falls in
 BOM()          Calculates beginning of the month date
 DOYEAR()       Calculates day of the year from date
 SETCENT()      Determines if century is on/off
 WOMONTH()      Calculates week of the month (# of 7 day periods)
 BEGEND()       Determines beginning or end of week,month or quarter
 SET_DATE()     Sets and restores date format

SP_BEGEND

BEGEND()

  Short:
  ------
  BEGEND() Determines beginning or end of week,month or quarter

  Returns:
  --------
  <dReturnDate> => Date of  beginning/end of week,month,qtr

  Syntax:
  -------
  BEGEND(dStartDate,nBeginEnd,nWkMnthQtr,[nDayofWeek])

  Description:
  ------------
  Returns date which is beginning (1) or end (0)
  <nBeginEnd> of week (1) , month (2) ,or quarter (3)
  <nWkMnthQtr> in which input date <dStartDate> falls. If week,
  [nDayofWeek] is day of the week beginning or end of the week
  <nBeginEnd> falls on, with Sunday being 1 and Saturday being 7.

  Examples:
  ---------
   dDate := ctod("01/15/90")
   bow   := BEGEND(dDate,1,1,1)  // beg of week
   eow   := BEGEND(dDate,0,1,7)  // end of week
   bom   := BEGEND(dDate,1,2)    // beg of month
   eow   := BEGEND(dDate,0,2)    // end of month
   boq   := BEGEND(dDate,1,3)    // beg of quarter
   eoq   := BEGEND(dDate,0,3)    // end of quarter

  Source:
  -------
  S_BEGEND.PRG