tntdb  1.3
tntdb::Date Class Reference

This class holds a date. More...

#include <date.h>

Public Member Functions

 Date ()
 Initializes the Date-object with empty values. More...
 
 Date (unsigned short year_, unsigned short month_, unsigned short day_)
 Initializes the date-object with the given values. More...
 
unsigned short getYear () const
 Returns the year-part of the Date. More...
 
unsigned short getMonth () const
 Returns the month-part of the Date. More...
 
unsigned short getDay () const
 Returns the day-part of the Date. More...
 
unsigned short getWDay () const
 Returns the day of week of the Date (0=sunday to 6=saturday). More...
 
bool isNull () const
 
void set (unsigned short year_, unsigned short month_, unsigned short day_)
 sets the date. More...
 
std::string getIso () const
 returns the date in ISO-format (yyyy-mm-dd) More...
 
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)
 interprets the passed string as a date-string in ISO-format (yyyy-mm-dd) and returns a Date-object. More...
 

Detailed Description

This class holds a date.

Constructor & Destructor Documentation

◆ Date() [1/2]

tntdb::Date::Date ( )
inline

Initializes the Date-object with empty values.

◆ Date() [2/2]

tntdb::Date::Date ( unsigned short  year_,
unsigned short  month_,
unsigned short  day_ 
)
inline

Initializes the date-object with the given values.

No range-checks are done.

Member Function Documentation

◆ fromIso()

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

interprets the passed string as a date-string in ISO-format (yyyy-mm-dd) and returns a Date-object.

When the string is not in ISO-format, a exception of type tntdb::TypeError is thrown.

◆ getDay()

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

Returns the day-part of the Date.

◆ getIso()

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

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

◆ getMonth()

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

Returns the month-part of the Date.

◆ getWDay()

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

Returns the day of week of the Date (0=sunday to 6=saturday).

◆ getYear()

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

Returns the year-part of the Date.

◆ set()

void tntdb::Date::set ( unsigned short  year_,
unsigned short  month_,
unsigned short  day_ 
)
inline

sets the date.


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