44 G_EXCEPTION( DateError ,
tx(
"invalid date") )
48 enum class Weekday { sunday, monday, tuesday, wednesday, thursday, friday, saturday } ;
50 enum class Month { january = 1 , february , march , april , may , june , july , august , september , october , november , december } ;
52 enum class Format { yyyy_mm_dd_slash , yyyy_mm_dd , mm_dd } ;
64 explicit
Date( const LocalTime & ) ;
68 explicit
Date( const BrokenDownTime & tm ) ;
71 explicit
Date( SystemTime t ) ;
75 Date( SystemTime t , const LocalTime & ) ;
83 Date(
int year , Month
month ,
int day_of_month ,
std::nothrow_t ) noexcept ;
86 std::
string str( Format format = Format::yyyy_mm_dd_slash ) const ;
99 std::
string dd() const ;
102 Month
month() const ;
108 std::
string mm() const ;
123 Date & operator++() ;
126 Date & operator--() ;
129 bool operator==( const
Date & rhs ) const ;
132 bool operator!=( const
Date & rhs ) const ;
136 void init( const BrokenDownTime & ) ;
138 static
int lastDay(
int month ,
int year ) ;
139 static
bool isLeapYear(
int y ) ;
145 bool m_weekday_set {
false} ;
146 Weekday m_weekday {Weekday::sunday} ;
An overload discriminator class for Date constructors.
A day-month-year date class.
Date()
Default constructor for the current date in the UTC timezone.
std::string monthName(bool brief=false) const
Returns the month as a string (in english).
std::string weekdayName(bool brief=false) const
Returns an english string representation of the day of the week.
Month month() const
Returns the month.
static int yearUpperLimit() noexcept
Returns the largest supported year value.
int monthday() const
Returns the day of the month.
std::string yyyy() const
Returns the year as a four-digit decimal string.
std::string dd() const
Returns the day of the month as a two-digit decimal string.
std::string str(Format format=Format::yyyy_mm_dd_slash) const
Returns a string representation of the date.
Weekday weekday() const
Returns the day of the week.
Date next() const
Returns the next date.
static int yearLowerLimit() noexcept
Returns the smallest supported year value.
Date previous() const
Returns the previous date.
int year() const
Returns the year.
std::string mm() const
Returns the month as a two-digit decimal string.
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().