The IDate class defines information functions that you can use to obtain specifics about an IDate object. For example, you can find out what day of the week, month, or year an IDate object's date falls on, or what the name of the day or month is for the current locale. You can also find out what today's date is. The following example shows some of the IDate information functions:
// Information functions for IDate class
#include <iostream.h> #include <istring.hpp> #include <idate.hpp>
void main () {
IDate Day1(27,IDate::May,1964);
cout << Day1.dayName() << " "
<< Day1.monthName() << " "
<< Day1.dayOfMonth() << " out of "
<< IDate::daysInMonth(Day1.monthOfYear(), Day1.year()) << " days in month, "
<< IDate::daysInYear(Day1.year()) << " days in year "
<< Day1.year() <<'.' << endl;
}
This program produces the following output:
Wednesday May 27 out of 31 days in month, 366 days in year 1964.