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_DTDIFF

DTDIFF()

  Short:
  ------
  DTDIFF() Returns difference between dates

  Returns:
  --------
  <nDifference> => days,weeks,months or years between
  dates

  Syntax:
  -------
  DTDIFF(dFirst,dSecond,nUnitType)

  Description:
  ------------
  Calculates difference between <dFirst> and <dSecond>
  in quantity defined by <nUnitType> as:

  1=whole days    2=whole weeks

  3=whole months  4=whole years

  Examples:
  ---------
   dDate     := ctod("10/15/89")
   dDate2    := ctod("10/26/89")
   nDiffdays     := DTDIFF(dDate,dDate2,1)
   nDiffweeks    := DTDIFF(dDate,dDate2,2)
   nDiffmonth    := DTDIFF(dDate,dDate2,3)
   nDiffyears    := DTDIFF(dDate,dDate2,4)

  Source:
  -------
  S_DTDIFF.PRG