This class holds a date. More...

#include <tntdb/date.h>

Public Member Functions

 Date ()
 Create a Date object with empty values.
 Date (unsigned short year, unsigned short month, unsigned short day)
 Create a date object with the given values.
unsigned short getYear () const
 Get the year part of the Date.
unsigned short getMonth () const
 Get the month part of the Date.
unsigned short getDay () const
 Get the day part of the Date.
unsigned short getWDay () const
 Get the day of week of the Date (from 0 = sunday to 6 = saturday)
bool isNull () const
void set (unsigned short year, unsigned short month, unsigned short day)
 Set the date.
std::string getIso () const
 Get the date in ISO format (yyyy-mm-dd)
bool operator== (const Date &dt) const
bool operator!= (const Date &dt) const
bool operator< (const Date &dt) const
bool operator> (const Date &dt) const
bool operator<= (const Date &dt) const
bool operator>= (const Date &dt) const

Static Public Member Functions

static Date localtime ()
static Date gmtime ()
static Date fromIso (const std::string &s)
 Construct a Date object from the given ISO date string.

Detailed Description

This class holds a date.

Constructor & Destructor Documentation

tntdb::Date::Date ( )
inline

Create a Date object with empty values.

tntdb::Date::Date ( unsigned short  year,
unsigned short  month,
unsigned short  day 
)
inline

Create a date object with the given values.

No range checks are done.

Member Function Documentation

static Date tntdb::Date::fromIso ( const std::string &  s)
static

Construct a Date object from the given ISO date string.

If the string is not in ISO format, an exception of type tntdb::TypeError is thrown.

unsigned short tntdb::Date::getDay ( ) const
inline

Get the day part of the Date.

std::string tntdb::Date::getIso ( ) const

Get the date in ISO format (yyyy-mm-dd)

unsigned short tntdb::Date::getMonth ( ) const
inline

Get the month part of the Date.

unsigned short tntdb::Date::getWDay ( ) const

Get the day of week of the Date (from 0 = sunday to 6 = saturday)

unsigned short tntdb::Date::getYear ( ) const
inline

Get the year part of the Date.

static Date tntdb::Date::gmtime ( )
static
bool tntdb::Date::isNull ( ) const
inline
static Date tntdb::Date::localtime ( )
static
bool tntdb::Date::operator!= ( const Date dt) const
inline
bool tntdb::Date::operator< ( const Date dt) const
inline
bool tntdb::Date::operator<= ( const Date dt) const
inline
bool tntdb::Date::operator== ( const Date dt) const
inline
bool tntdb::Date::operator> ( const Date dt) const
inline
bool tntdb::Date::operator>= ( const Date dt) const
inline
void tntdb::Date::set ( unsigned short  year,
unsigned short  month,
unsigned short  day 
)
inline

Set the date.


The documentation for this class was generated from the following file: