kdate - A Date Object (version 1.1) kdate is a C++ class that implements a date object. General: A kdate object holds a date in the range 1/1/1900 to 12/31/2099. Currently, kdate only implements a subset of a full-featured date object. In any sample code below, presume identifiers that start with: d are of type kdate s are of type kstring n are of type long kdate has four constructor functions: 1. A constructor with no arg; creates a 1/1/1900 date kdate d1; 2. A constructor with a c style string as an initial value kdate d1("6/10/95"); 3. A constructor with a kstring as an initial value kdate d1(s1); 4. A constructor with a month, day and year as an initial value kdate d1(m, d, y); The constructors with string arguments assume strings of the form "m/d/y" where m is the 1 or two digit month, d is the 1 or 2 digit day, and y is a 2 or four digit year. Two digit years are converted to four digit years as follows: if y, a two digit year is in the range first_two_digit_year to 99, add 1900 to y, else add 2000 to y. first_two_digit_year is set to 50. There is not a kdate destructor; no need for it; no dynamic memory. There are five member functions: long operator - (kdate & d); e.g. n_days = d1 - d2; // determint the number of days between dates kdate operator + (long delta_days); e.g. d2 = d1 + 100; // d2 is 100 days after d1 kdate operator - (long delta_days); e.g. d2 = d1 - 100; // d2 is 100 days before d1 kstring mm_dd_yy(); e.g. cout << d1.mm_dd_yy() << endl; // displays mm/dd/yy void get_m_d_y(int & month, int & day, int & year); e.g. d1.get(m, d, y); // sets m, d, and y to month, day & year in d1 There is a global function: long daynum(int month, int day, int year); // returns days since 1/1/1900 There is one global variable (see text above about first_two_digit_year) extern int first_two_digit_year;