#include <datetime.h>
Inheritance diagram for mysqlpp::DateTime:
Public Member Functions | |
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. | |
DateTime (time_t t) | |
Initialize object from a time_t. | |
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. | |
operator time_t () const | |
Convert to time_t. | |
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 |
Objects of this class can be inserted into streams, and initialized from MySQL DATETIME strings.
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] |
mysqlpp::DateTime::DateTime | ( | const std::string & | str | ) | [inline] |
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 >.
short int mysqlpp::DateTime::year |
the year
No surprises; the year 2005 is stored as the integer 2005.