|
MySQL++
3.3.0
|
C++ form of SQL's DATE type. More...
#include <datetime.h>


Public Member Functions | |
| Date () | |
| Default constructor. | |
| Date (unsigned short y, unsigned char m, unsigned char d) | |
| Initialize object. More... | |
| 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 (const char *str) | |
| Initialize object from a C string containing a date. More... | |
| template<class Str > | |
| Date (const Str &str) | |
| Initialize object from a C++ string containing a date. More... | |
| Date (time_t t) | |
Initialize object from a time_t. More... | |
| int | compare (const Date &other) const |
| Compare this date to another. More... | |
| const char * | convert (const char *) |
| Parse a SQL date string into this object. | |
| unsigned char | day () const |
| Get the date's day part, 1-31. | |
| void | day (unsigned char d) |
| Change the date's day part, 1-31. | |
| unsigned char | month () const |
| Get the date's month part, 1-12. | |
| void | month (unsigned char m) |
| Change the date's month part, 1-12. | |
| operator std::string () const | |
| Convert to std::string. | |
| operator time_t () const | |
| Convert to time_t. More... | |
| std::string | str () const |
| Return our value in std::string form. | |
| unsigned short | year () const |
| Get the date's year part. More... | |
| void | year (unsigned short y) |
| Change the date's year part. More... | |
Public Member Functions inherited from mysqlpp::Comparable< Date > | |
| bool | operator== (const Date &other) const |
| Returns true if "other" is equal to this object. | |
| bool | operator!= (const Date &other) const |
| Returns true if "other" is not equal to this object. | |
| bool | operator< (const Date &other) const |
| Returns true if "other" is less than this object. | |
| bool | operator<= (const Date &other) const |
| Returns true if "other" is less than or equal to this object. | |
| bool | operator> (const Date &other) const |
| Returns true if "other" is greater than this object. | |
| bool | operator>= (const Date &other) const |
| Returns true if "other" is greater than or equal to this object. | |
Additional Inherited Members | |
Protected Member Functions inherited from mysqlpp::Comparable< Date > | |
| virtual | ~Comparable () |
| Destroy object. More... | |
C++ form of SQL's DATE type.
Objects of this class can be inserted into streams, and initialized from SQL DATE strings.
|
inline |
Initialize object.
| y | year, 1000-9999 |
| m | month, 1-12 |
| d | day of month, 1-31 |
|
inlineexplicit |
Initialize object from a C string containing a date.
String must be in the YYYY-MM-DD format. It doesn't have to be zero-padded.
|
inlineexplicit |
Initialize object from a C++ string containing a date.
This works with any stringish class that declares a c_str() member function: std::string, mysqlpp::String...
|
explicit |
Initialize object from a time_t.
Naturally, we throw away the "time" part of the time_t. If you need to keep it, you want to use DateTime instead.
|
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::Comparable< Date >.
| mysqlpp::Date::operator time_t | ( | ) | const |
Convert to time_t.
The "time" part of the time_t is "now"
|
inline |
Get the date's year part.
There's no trickery here like in some date implementations where you have to add 1900 or something like that.
Referenced by mysqlpp::DateTime::convert().
|
inline |
Change the date's year part.
Pass the year value normally; we don't optimize the value by subtracting 1900 like some other date implementations.