Adbase
Adinf C++ base library V2
|
日期工具类 More...
#include <Date.hpp>
Classes | |
struct | YearMonthDay |
Public Member Functions | |
Date () | |
Constucts an invalid Date. More... | |
Date (int year, int month, int day) | |
Constucts a yyyy-mm-dd Date. More... | |
Date (int julianDayNum) | |
Constucts a Date from Julian Day Number. More... | |
Date (const struct tm &) | |
Constucts a Date from struct tm. More... | |
void | swap (Date &that) |
default copy/assignment/dtor are Okay More... | |
bool | valid () const |
Date is valid. More... | |
::std::string | toIsoString () const |
struct YearMonthDay | yearMonthDay () const |
int | year () const |
int | month () const |
int | day () const |
int | weekDay () const |
[0, 1, ..., 6] => [Sunday, Monday, ..., Saturday ] More... | |
int | julianDayNumber () const |
Static Public Attributes | |
static const int | kDaysPerWeek = 7 |
static const int | kJulianDayOf1970_01_01 = detail::getJulianDayNumber(1970, 1, 1) |
Friends | |
bool | operator< (Date x, Date y) |
bool | operator> (Date x, Date y) |
bool | operator== (Date x, Date y) |
|
inline |
Constucts an invalid Date.
Definition at line 32 of file Date.hpp.
References adbase::Date::YearMonthDay::day, adbase::Date::YearMonthDay::month, and adbase::Date::YearMonthDay::year.
Referenced by Date().
adbase::Date::Date | ( | int | year, |
int | month, | ||
int | day | ||
) |
|
inlineexplicit |
|
explicit |
|
inline |
Definition at line 65 of file Date.hpp.
References adbase::Date::YearMonthDay::day, and yearMonthDay().
|
inline |
Definition at line 74 of file Date.hpp.
References operator<, operator==, and operator>.
Referenced by adbase::TimeZone::fromUtcTime(), and adbase::TimeZone::toUtcTime().
|
inline |
Definition at line 61 of file Date.hpp.
References adbase::Date::YearMonthDay::month, and yearMonthDay().
|
inline |
std::string adbase::Date::toIsoString | ( | ) | const |
Definition at line 58 of file Date.cpp.
References adbase::Date::YearMonthDay::day, adbase::Date::YearMonthDay::month, adbase::Date::YearMonthDay::year, and yearMonthDay().
Referenced by valid().
|
inline |
|
inline |
[0, 1, ..., 6] => [Sunday, Monday, ..., Saturday ]
Definition at line 70 of file Date.hpp.
References kDaysPerWeek.
Referenced by adbase::TimeZone::toUtcTime().
|
inline |
Definition at line 57 of file Date.hpp.
References adbase::Date::YearMonthDay::year, and yearMonthDay().
Date::YearMonthDay adbase::Date::yearMonthDay | ( | ) | const |
Definition at line 68 of file Date.cpp.
References adbase::detail::getYearMonthDay().
Referenced by day(), month(), toIsoString(), adbase::TimeZone::toUtcTime(), and year().
Definition at line 86 of file Date.hpp.
Referenced by julianDayNumber().
Definition at line 94 of file Date.hpp.
Referenced by julianDayNumber().
Definition at line 90 of file Date.hpp.
Referenced by julianDayNumber().
|
static |
|
static |
Definition at line 29 of file Date.hpp.
Referenced by adbase::TimeZone::fromUtcTime(), adbase::detail::getYearMonthDay(), and adbase::TimeZone::toUtcTime().