Hikyuu
|
日期类型 更多...
#include <Datetime.h>
Public 成员函数 | |
Datetime () | |
默认构造函数,Null<Datetime> 更多... | |
Datetime (const Datetime &) | |
Datetime (int year, int month, int day, int hh=0, int mm=0, int sec=0) | |
Datetime (const bd::date &) | |
从boost::gregorian::date构造日期类型 更多... | |
Datetime (const bt::ptime &) | |
从boost::posix_time::ptime构造 更多... | |
Datetime (unsigned long long) | |
通过数字方式构造日期类型,数字格式:YYYYMMDDhhmmss,如 200101010000 更多... | |
Datetime (const std::string &) | |
通过字符串方式构造日期类型,如:"2001-01-01 18:00:00.12345" 更多... | |
Datetime & | operator= (const Datetime &) |
int | year () const |
int | month () const |
int | day () const |
int | hour () const |
int | minute () const |
int | second () const |
unsigned long long | number () const |
返回如YYYYMMDDhhmmss格式的数字,方便比较操作, Null<Datetime>()对应的 number 为 Null<unsigned long long> 更多... | |
std::string | toString () const |
bt::ptime | ptime () const |
返回 boost::posix_time::ptime 更多... | |
bd::date | date () const |
返回 boost::gregorian::date 更多... | |
int | dayOfWeek () const |
返回一周中的第几天,周日为0,周一为1 更多... | |
int | dayOfYear () const |
返回一年中的第几天,1月1日为1年中的第一天 更多... | |
Datetime | dateOfWeek (int day) const |
返回指定的本周中第几天的日期,周日为0天,周六为第6天 更多... | |
Datetime | startOfWeek () const |
返回周起始日期(周一) 更多... | |
Datetime | endOfWeek () const |
返回周结束日期(周日) 更多... | |
Datetime | startOfMonth () const |
返回月度起始日期 更多... | |
Datetime | endOfMonth () const |
返回月末日期,如12月31日 更多... | |
Datetime | startOfQuarter () const |
返回季度起始日期 更多... | |
Datetime | endOfQuarter () const |
返回季度结束日期 更多... | |
Datetime | startOfHalfyear () const |
返回半年起始日期 更多... | |
Datetime | endOfHalfyear () const |
返回半年结束日期 更多... | |
Datetime | startOfYear () const |
返回年度起始日期 更多... | |
Datetime | endOfYear () const |
返回年度结束日期 更多... | |
Datetime | nextDay () const |
下一自然日 更多... | |
Datetime | nextWeek () const |
下周起始日期(周一) 更多... | |
Datetime | nextMonth () const |
下月起始日期 更多... | |
Datetime | nextQuarter () const |
下一季度起始日期 更多... | |
Datetime | nextHalfyear () const |
下一半年度起始日期 更多... | |
Datetime | nextYear () const |
下一年度起始日期 更多... | |
Datetime | preDay () const |
上一自然日 更多... | |
Datetime | preWeek () const |
上一周周一日期 更多... | |
Datetime | preMonth () const |
上一月起始日期 更多... | |
Datetime | preQuarter () const |
上一季度起始日期 更多... | |
Datetime | preHalfyear () const |
上一半年度起始日期 更多... | |
Datetime | preYear () const |
上一年度起始日期 更多... | |
静态 Public 成员函数 | |
static Datetime | min () |
返回所能表示的最小日期:1400-Jan-01 00:00:00 更多... | |
static Datetime | max () |
返回所能表示的最大日期:9999-Dec-31 00:00:00 更多... | |
static Datetime | now () |
返回本地计算机当前时刻 更多... | |
static Datetime | today () |
返回本地计算机今日日期 更多... | |
日期类型
构造失败将抛出异常 std::out_of_range
|
inline |
默认构造函数,Null<Datetime>
|
inline |
|
inline |
|
inline |
从boost::gregorian::date构造日期类型
|
inline |
从boost::posix_time::ptime构造
|
explicit |
通过数字方式构造日期类型,数字格式:YYYYMMDDhhmmss,如 200101010000
|
inlineexplicit |
通过字符串方式构造日期类型,如:"2001-01-01 18:00:00.12345"
|
inline |
返回 boost::gregorian::date
Datetime hku::Datetime::dateOfWeek | ( | int | day | ) | const |
返回指定的本周中第几天的日期,周日为0天,周六为第6天
day | 指明本周的第几天,如不在0~6之间,将返回Null |
|
inline |
|
inline |
返回一周中的第几天,周日为0,周一为1
|
inline |
返回一年中的第几天,1月1日为1年中的第一天
Datetime hku::Datetime::endOfHalfyear | ( | ) | const |
返回半年结束日期
Datetime hku::Datetime::endOfMonth | ( | ) | const |
返回月末日期,如12月31日
Datetime hku::Datetime::endOfQuarter | ( | ) | const |
返回季度结束日期
Datetime hku::Datetime::endOfWeek | ( | ) | const |
返回周结束日期(周日)
Datetime hku::Datetime::endOfYear | ( | ) | const |
返回年度结束日期
|
inline |
|
static |
返回所能表示的最大日期:9999-Dec-31 00:00:00
|
static |
返回所能表示的最小日期:1400-Jan-01 00:00:00
|
inline |
|
inline |
Datetime hku::Datetime::nextDay | ( | ) | const |
下一自然日
Datetime hku::Datetime::nextHalfyear | ( | ) | const |
下一半年度起始日期
Datetime hku::Datetime::nextMonth | ( | ) | const |
下月起始日期
Datetime hku::Datetime::nextQuarter | ( | ) | const |
下一季度起始日期
Datetime hku::Datetime::nextWeek | ( | ) | const |
下周起始日期(周一)
Datetime hku::Datetime::nextYear | ( | ) | const |
下一年度起始日期
|
static |
返回本地计算机当前时刻
unsigned long long hku::Datetime::number | ( | ) | const |
返回如YYYYMMDDhhmmss格式的数字,方便比较操作, Null<Datetime>()对应的 number 为 Null<unsigned long long>
Datetime hku::Datetime::preDay | ( | ) | const |
上一自然日
Datetime hku::Datetime::preHalfyear | ( | ) | const |
上一半年度起始日期
Datetime hku::Datetime::preMonth | ( | ) | const |
上一月起始日期
Datetime hku::Datetime::preQuarter | ( | ) | const |
上一季度起始日期
Datetime hku::Datetime::preWeek | ( | ) | const |
上一周周一日期
Datetime hku::Datetime::preYear | ( | ) | const |
上一年度起始日期
|
inline |
返回 boost::posix_time::ptime
|
inline |
Datetime hku::Datetime::startOfHalfyear | ( | ) | const |
返回半年起始日期
Datetime hku::Datetime::startOfMonth | ( | ) | const |
返回月度起始日期
Datetime hku::Datetime::startOfQuarter | ( | ) | const |
返回季度起始日期
Datetime hku::Datetime::startOfWeek | ( | ) | const |
返回周起始日期(周一)
Datetime hku::Datetime::startOfYear | ( | ) | const |
返回年度起始日期
|
static |
返回本地计算机今日日期
std::string hku::Datetime::toString | ( | ) | const |
|
inline |