Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members

# mysqlpp::DateTime Struct Reference

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

`#include <datetime.h>`

Inheritance diagram for mysqlpp::DateTime:

[legend]
Collaboration diagram for mysqlpp::DateTime:

[legend]
List of all members.

## Public Methods
| DateTime ()
| Default constructor.
| DateTime (const DateTime &other)
| Initialize object as a copy of another Date.
| DateTime (cchar *str)
| Initialize object from a MySQL date-and-time string.
| DateTime (const ColData &str)
| Initialize object from a MySQL date-and-time string.
| DateTime (const std::string &str)
| Initialize object from a MySQL date-and-time string.
MYSQLPP_EXPORT short | compare (const DateTime &other) const
| Compare this datetime to another.
MYSQLPP_EXPORT cchar * | convert (cchar *)
| Parse a MySQL date and time 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
tiny_int | hour
| hour, 0-23
tiny_int | minute
| minute, 0-59
tiny_int | second
| second, 0-59

## Detailed Description

C++ form of MySQL's DATETIME type.

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

## Constructor & Destructor Documentation

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

| Initialize object from a MySQL date-and-time string. String must be in the HH:MM:SS format. It doesn't have to be zero-padded.

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

| Initialize object from a MySQL date-and-time string. See also: DateTime(cchar*)

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

| Initialize object from a MySQL date-and-time string. See also: DateTime(cchar*)

## Member Function Documentation

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

| Compare this datetime to another. Returns < 0 if this datetime is before the other, 0 of they are equal, and > 0 if this datetime is after the other. This method is protected because it is merely the engine used by the various operators in DTbase. Implements mysqlpp::DTbase< DateTime >.

## Member Data Documentation

short int mysqlpp::DateTime::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