- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
G::Date Class Reference

A date (dd/mm/yyyy) class. More...

`#include <gdate.h>`

## Classes
class | LocalTime
| An overload discriminator class for Date constructors. More...

## Public Types
enum | Weekday { sunday, monday, tuesday, wednesday, thursday, friday, saturday }
enum | Month { january = 1, february, march, april, may, june, july, august, september, october, november, december }
enum | Format { yyyy_mm_dd_slash, yyyy_mm_dd, mm_dd }

## Public Member Functions
| Date ()
| Default constructor for the current date in the UTC timezone. More...
| Date (const LocalTime &)
| Constructor for the current date in the local timezone. More...
| Date (const G::DateTime::BrokenDownTime &tm)
| Constructor for the specified date. More...
| Date (G::DateTime::EpochTime t)
| Constructor for the date in the UTC timezone as at the given epoch time. More...
| Date (G::DateTime::EpochTime t, const LocalTime &)
| Constructor for the date in the local timezone as at the given epoch time. More...
| Date (int year, Month month, int day_of_month)
| Constructor for the specified date. More...
std::string | string (Format format=yyyy_mm_dd_slash) const
| Returns a string representation of the date. More...
Weekday | weekday () const
| Returns the day of the week. More...
std::string | weekdayName (bool brief=false) const
| Returns an english string representation of the day of the week. More...
int | monthday () const
| Returns the day of the month. More...
std::string | dd () const
| Returns the day of the month as a two-digit decimal string. More...
Month | month () const
| Returns the month. More...
std::string | monthName (bool brief=false) const
| Returns the month as a string (in english). More...
std::string | mm () const
| Returns the month as a two-digit decimal string. More...
int | year () const
| Returns the year. More...
std::string | yyyy () const
| Returns the year as a four-digit decimal string. More...
Date & | operator++ ()
| Increments the date by one day. More...
Date & | operator-- ()
| Decrements the date by one day. More...
bool | operator== (const Date &rhs) const
| Comparison operator. More...
bool | operator!= (const Date &rhs) const
| Comparison operator. More...

## Static Public Member Functions
static int | yearUpperLimit ()
| Returns the largest supported year value. More...
static int | yearLowerLimit ()
| Returns the smallest supported year value. More...

## Detailed Description

A date (dd/mm/yyyy) class.

See also
  G::Time, G::DateTime

Definition at line 40 of file gdate.h.

## Member Enumeration Documentation

enum G::Date::Format

Enumerator
yyyy_mm_dd_slash |
yyyy_mm_dd |
mm_dd |

Definition at line 54 of file gdate.h.

enum G::Date::Month

Enumerator
january |
february |
march |
april |
may |
june |
july |
august |
september |
october |
november |
december |

Definition at line 50 of file gdate.h.

enum G::Date::Weekday

Enumerator
sunday |
monday |
tuesday |
wednesday |
thursday |
friday |
saturday |

Definition at line 47 of file gdate.h.

## Constructor & Destructor Documentation

G::Date::Date | ( |  | ) |

Default constructor for the current date in the UTC timezone.

Definition at line 38 of file gdate.cpp.

References G::DateTime::now(), and G::DateTime::utc().

G::Date::Date | ( | const LocalTime & |  | ) |
| explicit

Constructor for the current date in the local timezone.

Definition at line 58 of file gdate.cpp.

References G::DateTime::local(), and G::DateTime::now().

G::Date::Date | ( | const G::DateTime::BrokenDownTime & | tm | ) |

Constructor for the specified date.

Definition at line 53 of file gdate.cpp.

G::Date::Date | ( | G::DateTime::EpochTime | t | ) |
| explicit

Constructor for the date in the UTC timezone as at the given epoch time.

Definition at line 43 of file gdate.cpp.

References G::DateTime::utc().

G::Date::Date | ( | G::DateTime::EpochTime | t,
|  | const LocalTime & |
| ) |  |

Constructor for the date in the local timezone as at the given epoch time.

Definition at line 48 of file gdate.cpp.

References G::DateTime::local().

G::Date::Date | ( | int | year,
|  | Month | month,
|  | int | day_of_month
| ) |  |

Constructor for the specified date.

Definition at line 63 of file gdate.cpp.

References G_ASSERT.

## Member Function Documentation

std::string G::Date::dd | ( |  | ) | const

Returns the day of the month as a two-digit decimal string.

(Was monthdayString().)

Definition at line 116 of file gdate.cpp.

std::string G::Date::mm | ( |  | ) | const

Returns the month as a two-digit decimal string.

Definition at line 123 of file gdate.cpp.

G::Date::Month G::Date::month | ( |  | ) | const

Returns the month.

Definition at line 165 of file gdate.cpp.

Referenced by operator==().

int G::Date::monthday | ( |  | ) | const

Returns the day of the month.

Definition at line 111 of file gdate.cpp.

Referenced by operator==(), and GSmtp::ServerProtocolText::receivedLine().

std::string G::Date::monthName | ( | bool | brief = `false` | ) | const

Returns the month as a string (in english).

Definition at line 170 of file gdate.cpp.

Referenced by GSmtp::ServerProtocolText::receivedLine().

bool G::Date::operator!= | ( | const Date & | rhs | ) | const

Comparison operator.

Definition at line 285 of file gdate.cpp.

G::Date & G::Date::operator++ | ( |  | ) |

Increments the date by one day.

Definition at line 199 of file gdate.cpp.

G::Date & G::Date::operator-- | ( |  | ) |

Decrements the date by one day.

Definition at line 222 of file gdate.cpp.

bool G::Date::operator== | ( | const Date & | rhs | ) | const

Comparison operator.

Definition at line 277 of file gdate.cpp.

References month(), monthday(), and year().

std::string G::Date::string | ( | Format | format = `yyyy_mm_dd_slash` | ) | const

Returns a string representation of the date.

Definition at line 89 of file gdate.cpp.

References G_ASSERT.

G::Date::Weekday G::Date::weekday | ( |  | ) | const

Returns the day of the week.

Definition at line 130 of file gdate.cpp.

References G::DateTime::epochTime(), and G::DateTime::utc().

std::string G::Date::weekdayName | ( | bool | brief = `false` | ) | const

Returns an english string representation of the day of the week.

(Was weekdayString().)

Definition at line 153 of file gdate.cpp.

Referenced by GSmtp::ServerProtocolText::receivedLine().

int G::Date::year | ( |  | ) | const

Returns the year.

Definition at line 187 of file gdate.cpp.

Referenced by operator==().

int G::Date::yearLowerLimit | ( |  | ) |
| static

Returns the smallest supported year value.

Definition at line 33 of file gdate.cpp.

int G::Date::yearUpperLimit | ( |  | ) |
| static

Returns the largest supported year value.

Definition at line 28 of file gdate.cpp.

std::string G::Date::yyyy | ( |  | ) | const

Returns the year as a four-digit decimal string.

(Was yearString().)

Definition at line 192 of file gdate.cpp.

Referenced by GSmtp::ServerProtocolText::receivedLine().

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

- gdate.h
- gdate.cpp