home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / source / dates2.lha / datetest.c < prev   
C/C++ Source or Header  |  1987-07-27  |  1KB  |  46 lines

  1. /******************************************************************************
  2.     datetest.c
  3.  
  4.     A program to test and demonstrate the functions in the #include
  5.     file <dates.h>.
  6.  
  7.  
  8.    I can be contacted via:
  9.  
  10.     GEnie (K.RAHE)
  11.  
  12.     The ESCAPE BBS  (SysOp)
  13.     (616) 784-6550
  14.     300/1200 baud, 8-N-1
  15.  
  16.     Kevin Rahe    (or Reliable Software)
  17.     340 Nine Mile Rd. N.E.
  18.     Comstock Park, MI  49321
  19.     (616) 784-6805
  20.  
  21. ******************************************************************************/
  22.  
  23. #include <dates2.h>
  24.  
  25. main()
  26. {
  27.     long juldate, juldate2;
  28.     char strdate1[11], strdate2[11];
  29.     short day, month, numdays;
  30.  
  31.     juldate = get_date();        /**  get date from Exec  **/
  32.     jultogreg(strdate1, juldate);    /**  convert to Gregorian  **/
  33.     printf("System Date (Gregorian) ==  %s  %s\n",
  34.         dayofweek(juldate), strdate1);
  35.     printf("System Date (Julian) == %ld\n", juldate);
  36.     day = datestat(juldate, &month, 0L, &numdays);
  37.     printf("The current date is %d, and the month is %d\n", day, month);
  38.     printf("The number of days in the current month is %d\n\n", numdays);
  39.     printf("Enter two dates: (MM-DD-YY[YY] MM-DD-YY[YY])\n");
  40.     scanf("%s  %s", strdate1, strdate2);
  41.     printf("Julian of date 1 is %ld.  Julian of date 2 is %ld\n",
  42.         (juldate = gregtojul(strdate1)),
  43.         (juldate2 = gregtojul(strdate2)) );
  44.     printf("Day span is: %ld\n", juldate2 - juldate);
  45. }
  46.