home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / dbase / udfs / udf1.prg next >
Text File  |  1992-05-06  |  1KB  |  36 lines

  1. /*
  2.  
  3. Author:           DAVID -(FLASH)- GORDON     CompuServ ID - 75130,3664
  4.  
  5. Originally:       Program COPYRIGHT 1991, FlashPoint
  6.  
  7. Now and Forever:  Released into the Public Domain
  8.  
  9. Note:             FlashPoint is a Registered Trademark
  10.  
  11. Purpose:          DateSwap() was designed for date validation.  It is
  12.                   mainly used with reports covering a date range.  It
  13.                   will ensure that the users two date fields are kept
  14.                   in the proper sequence and that they are real dates.
  15. */
  16.  
  17. * Usage In Your Application
  18. ******************************************************************************
  19.  
  20. LOCAL dFirst := dSecond := CTOD("  /  /  ")
  21.  
  22. DateSwap(@dFirst, @dSecond)
  23.  
  24. ******************************************************************************
  25.  
  26. FUNCTION DateSwap(dDate1, dDate2)
  27.     LOCAL dTemp
  28.     IIF( dDate1 == ctod("  /  /  "), dDate1 := date(), )
  29.     IIF( dDate2 == ctod("  /  /  "), dDate2 := date(), )
  30.     IF dDate1 > dDate2
  31.         dTemp  := dDate1
  32.         dDate1 := dDate2
  33.         dDate2 := dTemp
  34.     ENDIF
  35. return .t.
  36.