# mysqlpp::Date Struct Reference

C++ form of MySQL's DATE type. More...

`#include <datetime.h>`

Inheritance diagram for mysqlpp::Date:

[legend]
Collaboration diagram for mysqlpp::Date:

[legend]
List of all members.

## Public Member Functions

| Date ()
| Default constructor.
| Date (short int y, tiny_int m, tiny_int d)
| Initialize object.
| Date (const Date &other)
| Initialize object as a copy of another Date.
| Date (const DateTime &other)
| Initialize object from date part of date/time object.
| Date (cchar *str)
| Initialize object from a MySQL date string.
| Date (const ColData &str)
| Initialize object from a MySQL date string.
| Date (const std::string &str)
| Initialize object from a MySQL date string.
MYSQLPP_EXPORT short int | compare (const Date &other) const
| Compare this date to another.
MYSQLPP_EXPORT cchar * | convert (cchar *)
| Parse a MySQL date string into this object.

## Public Attributes

short int | year
| the year
tiny_int | month
| the month, 1-12
tiny_int | day
| the day, 1-31

## Detailed Description

C++ form of MySQL's DATE type.

Objects of this class can be inserted into streams, and initialized from MySQL DATE strings.

## Constructor & Destructor Documentation

mysqlpp::Date::Date | ( | cchar * | str | ) | `[inline]`

| Initialize object from a MySQL date string. String must be in the YYYY-MM-DD format. It doesn't have to be zero-padded.

mysqlpp::Date::Date | ( | const ColData & | str | ) | `[inline]`

Initialize object from a MySQL date string.

See also:
  Date(cchar*)

mysqlpp::Date::Date | ( | const std::string & | str | ) | `[inline]`

Initialize object from a MySQL date string.

See also:
  Date(cchar*)

## Member Function Documentation

short int mysqlpp::Date::compare | ( | const Date & | other | ) | const`[virtual]`

| Compare this date to another. Returns < 0 if this date is before the other, 0 of they are equal, and > 0 if this date is after the other. Implements mysqlpp::DTbase< Date >.

## Member Data Documentation

short int mysqlpp::Date::year

| the year No surprises; the year 2005 is stored as the integer 2005.

The documentation for this struct was generated from the following files:

- datetime.h
- datetime.cpp