home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Programmieren / Kurztests / ACE / Prgs / ShellUtils / days.b < prev    next >
Text File  |  1994-01-10  |  644b  |  22 lines

  1. { ** show the number of days difference between two dates **
  2.  
  3.   (illustrates the use of julday and calday$ subprograms in julian.h)
  4.  
  5.   Author: David J Benn
  6.     Date: 9th April 1993 }
  7.  
  8. #include <julian.h>
  9.  
  10. if argcount=2 then 
  11.   dt1$=arg$(1) : if ucase$(dt1$)="TODAY" then dt1$=date$
  12.   dt2$=arg$(2) : if ucase$(dt2$)="TODAY" then dt2$=date$
  13.   jd1 = julday(dt1$)
  14.   jd2 = julday(dt2$)
  15.   print "There is a difference of";abs(jd2-jd1);"days between ";
  16.   print calday$(jd1);" and ";calday$(jd2);"."
  17. else
  18.   print "usage: days <date1>|today <date2>|today"
  19.   print "       where date1 & date2 are strings"
  20.   print "       of the form mm-dd-yyyy."
  21. end if
  22.