home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
source
/
dates2.lha
/
datetest.c
< prev
Wrap
C/C++ Source or Header
|
1987-07-27
|
1KB
|
46 lines
/******************************************************************************
datetest.c
A program to test and demonstrate the functions in the #include
file <dates.h>.
I can be contacted via:
GEnie (K.RAHE)
The ESCAPE BBS (SysOp)
(616) 784-6550
300/1200 baud, 8-N-1
Kevin Rahe (or Reliable Software)
340 Nine Mile Rd. N.E.
Comstock Park, MI 49321
(616) 784-6805
******************************************************************************/
#include <dates2.h>
main()
{
long juldate, juldate2;
char strdate1[11], strdate2[11];
short day, month, numdays;
juldate = get_date(); /** get date from Exec **/
jultogreg(strdate1, juldate); /** convert to Gregorian **/
printf("System Date (Gregorian) == %s %s\n",
dayofweek(juldate), strdate1);
printf("System Date (Julian) == %ld\n", juldate);
day = datestat(juldate, &month, 0L, &numdays);
printf("The current date is %d, and the month is %d\n", day, month);
printf("The number of days in the current month is %d\n\n", numdays);
printf("Enter two dates: (MM-DD-YY[YY] MM-DD-YY[YY])\n");
scanf("%s %s", strdate1, strdate2);
printf("Julian of date 1 is %ld. Julian of date 2 is %ld\n",
(juldate = gregtojul(strdate1)),
(juldate2 = gregtojul(strdate2)) );
printf("Day span is: %ld\n", juldate2 - juldate);
}