tntdb::Date Class Reference

This class holds a date. More...

`#include <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

## Date() [1/2]

tntdb::Date::Date | ( |  | ) |

inline

Create a Date object with empty values.

## Date() [2/2]

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

## fromIso()

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.

## getDay()

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

inline

Get the day part of the Date.

## getIso()

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

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

## getMonth()

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

inline

Get the month part of the Date.

## getWDay()

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

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

## getYear()

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

inline

Get the year part of the Date.

## set()

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:

- tntdb/date.h