# Date Class

Topics
Overview | Functions

Overview

The CDate class is used to turn a date string into concrete data type. Dates are represented by a two-digit month, a two-digit day, and a four-digit year:

      __UBYTE__ Month;
      __UBYTE__ Day;
      UINT16  Year;

The type definitions and classes use to represent unsigned bytes and unsigned short integers are used to create platform independent date strings that can be written to VBD files. See platform independent data types.

Functions

CDate::CDate()

- Default class constructor.

CDate::CDate(__UBYTE__ month, __UBYTE__ day, UINT16 year)

- Class constructor used to construct a CDate object with a specified month, day, and year.

CDate::CDate(const CDate& ob)

- Class copy constructor use to copy construct a CDate object.

CDate::CDate& operator=(const CDate& ob)

- Overloaded assignment operator used to assign the specified CDate object to the object that invoked the call.

void CDate::SetDay(__UBYTE__ byte)

- Public member function used to set the day.

void CDate::SetMonth(__UBYTE__ byte)

- Public member function used to set the month.

void CDate::SetYear(UINT16 uint16)

- Public member function used to set the year.

void CDate::SetDate(__UBYTE__ month, __UBYTE__ day, UINT16 year)

- Public member function used to set the month, the day, and the year.

__UBYTE__ CDate::GetDay()

- Public member function that returns the current day.

__UBYTE__ CDate::GetMonth()

- Public member function that returns the current month.

UINT16 CDate::GetYear()

- Public member function that returns the current year.

char *CDate::c_str()

- Public member function that returns the month, day and year in the form of a null-terminated string: MM/DD/YYYY

const char *CDate::c_str() const

- Public member function that returns the month, day and year in the form of a null-terminated string: MM/DD/YYYY

char *CDate::month_c_str()

- Public member function that returns the month in the form of a null-terminated string.

const char *CDate::month_c_str() const

- Public member function that returns the month in the form of a null-terminated string.

char *CDate::day_c_str()

- Public member function that returns the day in the form of a null-terminated string.

const char *CDate::day_c_str() const

- Public member function that returns the day in the form of a null-terminated string.

char *CDate::year_c_str()

- Public member function that returns the year in the form of a null-terminated string.

const char *CDate::year_c_str() const

- Public member function that returns the year in the form of a null-terminated string.

unsigned CDate::SizeOf()

- Public member function that returns the size of a CDate object.

friend int operator==(const CDate &a, const CDate &b)

- Overload operator that returns true if CData object a is equal to CDate object b. This comparison works by comparing the year members, then the month members, and then day members.

friend int operator!=(const CDate &a, const CDate &b)

- Overload operator that returns true if CData object a is not equal to CDate object b. This comparison works by comparing the year members, then the month members, and then day members.

friend int operator<(const CDate &a, const CDate &b)

- Overload operator that returns true if CData object a is less then CDate object b. This comparison works by comparing the year members, then the month members, and then day members.

friend ostream &operator<<(ostream &os, const CDate &ob)

- Overloaded operator used to print a date string to the output stream. The __USE_CPP_IOSTREAM__ macro must be defined at compile time to enable this overloaded operator.

friend void operator>>(istream &is, CDate &ob)

- Overloaded operator used to enter a date string from the input stream. The __USE_CPP_IOSTREAM__ macro must be defined at compile time to enable this overloaded operator.

End Of Document