home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxdate20.zip / testdate.cmd < prev   
OS/2 REXX Batch file  |  1994-10-09  |  890b  |  34 lines

  1. /*
  2.     Example of using the RexxDate function package
  3.  
  4.     Usage: rxdate <date-string> <format-string>
  5. */
  6.  
  7. /* check whether the RxDate Function is loaded, if not, load it */
  8. IF RxFuncQuery('RxDate')
  9.     THEN CALL RxFuncAdd 'RxDate', 'RexxDate', 'RxDate'
  10.  
  11. parse arg myDate myFormat
  12.  
  13. if myFormat = ''
  14.     then myFormat = '%A %B %d, %Y'
  15.  
  16. myDateCode = RxDate(myDate)
  17. say 'DateCode =' myDateCode', formatted version =' RxDate(myDateCode, myFormat)
  18.  
  19.  
  20. /*
  21. ** Find the day New Year's Eve falls on, and how many days until then
  22. */
  23. til_newyears = rxDate('12/31') - myDateCode
  24. say 'New Year''s Eve' rxDate(, '%Y') 'falls on' rxDate('12/31', '%A')', days left =' til_newyears
  25.  
  26.  
  27. /*
  28. **  Figure out the beginning and ending of this week
  29. */
  30. sunday = myDateCode - RxDate(myDateCode, '%w')
  31. say 'This week is' RxDate(sunday, myFormat) 'thru' RxDate(sunday+6, myFormat)
  32.  
  33. return
  34.