Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- SuperLib 3.50 - function datecalc() http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FUNCTION DATECALC()

  Short:
  ------
  DATECALC() Adds/subtracts days,weeks,months,years to a date

  Returns:
  --------
  <dNew> => new date

  Syntax:
  -------
  DATECALC(dStart,nUnits,nUnitType)

  Description:
  ------------
  <nUnits> is the number of units to add or subtract.
  If negative, subtraction takes place.

  <nUnitType> is the type of unit, where 1=days ,2=wks,
  3=mnths, 4=yrs

  <dStart> is the source date, to which units are added
  or subtracted.

  Examples:
  ---------
   dDate          := ctod("10/15/89")

   dLess5days    := DATECALC(dDate,-5,1)  // subtract 5 days
   dLess5weeks   := DATECALC(dDate,-5,2)  // subtract 5 weeks
   dAdd5months   := DATECALC(dDate,5,3) // add 5 months
   dAdd5years    := DATECALC(dDate,5,4)  // add 5 years

  Notes:
  -------
  Month adding/subtracting where the day of current
  month is greater than the # of days in the target month is done
  by using the # of days in the target month. i.e. 01/31/90 + 1
  month = 02/28/90

  If the input date is Feb 29th of a leap year, it is
  adjusted to Feb 28th before month or year calculations.

  Source:
  -------
  S_DATCAL.PRG


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson