|
NexusForce 1.0.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
日期时间类 更多...
#include <datetime.hpp>
Public 类型 | |
| using | date_type = _NEFORCE date::date_type |
| 日期分量类型 | |
| using | time_type = _NEFORCE time::time_type |
| 时间分量类型 | |
Public 成员函数 | |
| constexpr | datetime (const date_type year, const date_type month, const date_type day, const time_type hour, const time_type minute, const time_type second) noexcept |
| 从日期和时间构造 | |
| constexpr | datetime (const date_type year, const date_type month, const date_type day, const time_type hour, const time_type minute, const time_type second, const int64_t offset) noexcept |
| 从日期、时间和时区构造 | |
| constexpr | datetime (const _NEFORCE date &date, const _NEFORCE time &time) noexcept |
| 从日期和时间对象构造 | |
| constexpr | datetime (const _NEFORCE date &date, const _NEFORCE time &time, const int64_t offset) noexcept |
| 从日期、时间对象和时区构造 | |
| constexpr | datetime (const _NEFORCE date &date) noexcept |
| 从日期构造(时间部分为00:00:00) | |
| constexpr | datetime (const _NEFORCE time &time) noexcept |
| 从时间构造(日期部分为1970-01-01) | |
| constexpr | datetime (_NEFORCE date &&date) noexcept |
| 从日期构造(时间部分为00:00:00) | |
| constexpr | datetime (_NEFORCE time &&time) noexcept |
| 从时间构造(日期部分为1970-01-01) | |
| constexpr | datetime (_NEFORCE date &&date, _NEFORCE time &&time) noexcept |
| 从日期和时间对象移动构造 | |
| constexpr | datetime (_NEFORCE date &&date, _NEFORCE time &&time, const int64_t offset) noexcept |
| 从日期、时间对象和时区移动构造 | |
| constexpr bool | is_valid () const noexcept |
| 检查时间是否有效 | |
| constexpr datetime & | operator= (const _NEFORCE date &date) noexcept |
| 从日期赋值 | |
| constexpr datetime & | operator= (_NEFORCE date &&date) noexcept |
| 从日期移动赋值 | |
| constexpr datetime & | operator= (const _NEFORCE time &time) noexcept |
| 从时间赋值 | |
| constexpr datetime & | operator= (_NEFORCE time &&time) noexcept |
| 从时间移动赋值 | |
| NEFORCE_NODISCARD constexpr const _NEFORCE date & | date () const noexcept |
| 获取日期部分 | |
| NEFORCE_NODISCARD constexpr const _NEFORCE time & | time () const noexcept |
| 获取时间部分 | |
| NEFORCE_NODISCARD constexpr time_type | hours () const noexcept |
| 获取小时 | |
| NEFORCE_NODISCARD constexpr time_type | minutes () const noexcept |
| 获取分钟 | |
| NEFORCE_NODISCARD constexpr time_type | seconds () const noexcept |
| 获取秒 | |
| NEFORCE_NODISCARD constexpr date_type | year () const noexcept |
| 获取年份 | |
| NEFORCE_NODISCARD constexpr date_type | month () const noexcept |
| 获取月份 | |
| NEFORCE_NODISCARD constexpr date_type | day () const noexcept |
| 获取日期 | |
| NEFORCE_NODISCARD constexpr bool | has_timezone () const noexcept |
| 检查是否有时区信息 | |
| NEFORCE_NODISCARD constexpr int64_t | offset_seconds () const noexcept |
| 获取时区偏移 | |
| constexpr void | clear () noexcept |
| 重置为纪元起始时间 | |
| constexpr bool | operator== (const datetime &other) const noexcept |
| 相等比较 | |
| constexpr bool | operator< (const datetime &other) const noexcept |
| 小于比较 | |
| constexpr datetime & | operator+= (const int64_t seconds) |
| 加秒数 | |
| constexpr datetime & | operator-= (const int64_t seconds) noexcept |
| 减秒数 | |
| constexpr datetime | operator+ (const int64_t seconds) const noexcept |
| 加秒数 | |
| constexpr datetime | operator- (const int64_t seconds) const noexcept |
| 减秒数 | |
| constexpr datetime & | operator++ () |
| 前置递增(加1秒) | |
| constexpr datetime | operator++ (int) |
| 后置递增(加1秒) | |
| constexpr datetime & | operator-- () |
| 前置递减(减1秒) | |
| constexpr datetime | operator-- (int) |
| 后置递减(减1秒) | |
| constexpr time_type | operator- (const datetime &other) const noexcept |
| 时间差(秒数) | |
| NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string | to_offset_string () const |
| 转换为时区偏移字符串 | |
| NEFORCE_NODISCARD constexpr datetime | to_UTC () const noexcept |
| 转换为UTC时间 | |
| NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string | to_string_ISO_UTC () const |
| 转换为ISO格式带时区 | |
| NEFORCE_CONSTEXPR20 bool | try_parse_ISO_UTC (const string_view view) noexcept |
| 尝试解析ISO格式带时区 | |
| NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string | to_string_GMT () const noexcept |
| 转换为GMT格式(RFC 1123) | |
| NEFORCE_CONSTEXPR20 bool | try_parse_GMT (const string_view view) noexcept |
| 尝试解析GMT格式 | |
| NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string | to_string_ISO () const |
| 转换为ISO格式(无时区) | |
| NEFORCE_CONSTEXPR20 bool | try_parse_ISO (const string_view view) noexcept |
| 尝试解析ISO格式(无时区) | |
| NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string | to_string () const |
| 转换为简单格式 | |
| NEFORCE_NODISCARD constexpr size_t | to_hash () const noexcept |
| 计算哈希值 | |
| constexpr void | swap (datetime &other) noexcept |
| 交换两个日期时间 | |
| Public 成员函数 继承自 iobject< datetime > | |
| NEFORCE_CONSTEXPR20 bool | try_parse (const string_view str) noexcept |
| 尝试从字符串解析对象 | |
| Public 成员函数 继承自 istringify< datetime > | |
| NEFORCE_NODISCARD NEFORCE_CONSTEXPR20 string | to_string () const |
| 转换为字符串 | |
| Public 成员函数 继承自 icomparable< datetime > | |
| NEFORCE_NODISCARD constexpr bool | operator== (const datetime &rhs) const noexcept(noexcept(derived()==rhs)) |
| 相等比较运算符 | |
| NEFORCE_NODISCARD constexpr bool | operator!= (const datetime &rhs) const noexcept(noexcept(!(*this==rhs))) |
| 不等比较运算符 | |
| NEFORCE_NODISCARD constexpr bool | operator< (const datetime &rhs) const noexcept(noexcept(derived()< rhs)) |
| 小于比较运算符 | |
| NEFORCE_NODISCARD constexpr bool | operator> (const datetime &rhs) const noexcept(noexcept(rhs< derived())) |
| 大于比较运算符 | |
| NEFORCE_NODISCARD constexpr bool | operator<= (const datetime &rhs) const noexcept(noexcept(!(derived() > rhs))) |
| 小于等于比较运算符 | |
| NEFORCE_NODISCARD constexpr bool | operator>= (const datetime &rhs) const noexcept(noexcept(!(derived()< rhs))) |
| 大于等于比较运算符 | |
| Public 成员函数 继承自 ihashable< datetime > | |
| NEFORCE_NODISCARD constexpr size_t | to_hash () const noexcept(noexcept(derived().to_hash())) |
| 获取对象的哈希值 | |
静态 Public 成员函数 | |
| static NEFORCE_NODISCARD constexpr datetime | epoch () noexcept |
| 获取纪元起始时间(1970-01-01 00:00:00 UTC) | |
| static NEFORCE_NODISCARD datetime | now () noexcept |
| 获取当前本地时间 | |
| static constexpr datetime | from_UTC (const datetime &utc, const int32_t offset=0) noexcept |
| 从UTC时间转换为本地时间 | |
| static NEFORCE_NODISCARD constexpr datetime | parse_ISO_UTC (const string_view view) |
| 解析ISO格式带时区 | |
| static NEFORCE_NODISCARD constexpr datetime | parse_GMT (string_view view) |
| 解析GMT格式 | |
| static NEFORCE_NODISCARD constexpr datetime | parse_ISO (const string_view view) |
| 解析ISO格式(无时区) | |
| static NEFORCE_NODISCARD constexpr datetime | parse (const string_view view) |
| 解析简单格式 | |
| 静态 Public 成员函数 继承自 iobject< datetime > | |
| static NEFORCE_NODISCARD constexpr datetime | parse (const string_view str) |
| 从字符串解析对象 | |
日期时间类
组合日期和时间,支持时区处理。 提供多种格式的解析和格式化:
在文件 datetime.hpp 第 734 行定义.
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
从日期、时间和时区构造
| year | 年份 |
| month | 月份 |
| day | 日期 |
| hour | 小时 |
| minute | 分钟 |
| second | 秒 |
| offset | 时区偏移(秒) |
在文件 datetime.hpp 第 796 行定义.
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineconstexprnoexcept |
获取日期部分
在文件 datetime.hpp 第 935 行定义.
引用了 date().
被这些函数引用 date(), datetime(), datetime(), datetime(), datetime(), datetime(), datetime(), sqlite_prepared_result::get_date(), sqlite_result::get_date(), operator=(), operator=(), parse(), parse_ISO(), parse_ISO_UTC() , 以及 to_string_GMT().
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
获取纪元起始时间(1970-01-01 00:00:00 UTC)
在文件 datetime.hpp 第 995 行定义.
被这些函数引用 timestamp::timestamp() , 以及 timestamp::to_datetime().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
staticnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexpr |
解析简单格式
| view | 格式为 YYYY-MM-DD HH:MM:SS 的字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1416 行定义.
引用了 date(), date::parse(), time::parse(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
|
inlinestaticconstexpr |
解析GMT格式
| view | GMT格式字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1314 行定义.
引用了 day(), basic_string_view< CharT, Traits >::remove_prefix(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 year().
被这些函数引用 try_parse_GMT().
|
inlinestaticconstexpr |
解析ISO格式(无时区)
| view | ISO格式字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1374 行定义.
引用了 date(), date::parse(), time::parse(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
被这些函数引用 try_parse_ISO().
|
inlinestaticconstexpr |
解析ISO格式带时区
| view | ISO格式字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1232 行定义.
引用了 date(), hours(), minutes(), date::parse(), time::parse(), sign(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
被这些函数引用 try_parse_ISO_UTC().
|
inlineconstexprnoexcept |
获取秒
在文件 datetime.hpp 第 959 行定义.
被这些函数引用 operator+(), operator+=(), operator-() , 以及 operator-=().
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
获取时间部分
在文件 datetime.hpp 第 941 行定义.
引用了 time().
被这些函数引用 datetime(), datetime(), datetime(), datetime(), datetime(), datetime(), sqlite_prepared_result::get_time(), sqlite_result::get_time(), operator+=(), operator-=(), operator=(), operator=(), parse(), parse_ISO(), parse_ISO_UTC(), time() , 以及 to_string_GMT().
|
inlineconstexprnoexcept |
|
inline |
转换为时区偏移字符串
在文件 datetime.hpp 第 1167 行定义.
引用了 format(), hours(), minutes() , 以及 sign().
被这些函数引用 to_string_ISO_UTC().
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
转换为ISO格式带时区
在文件 datetime.hpp 第 1218 行定义.
引用了 to_offset_string().
|
inlineconstexprnoexcept |
转换为UTC时间
在文件 datetime.hpp 第 1203 行定义.
被这些函数引用 from_UTC(), operator-() , 以及 timestamp::timestamp().
|
inlinenoexcept |
|
inlinenoexcept |
尝试解析ISO格式(无时区)
| view | ISO格式字符串 |
在文件 datetime.hpp 第 1392 行定义.
引用了 parse_ISO() , 以及 swap().
被这些函数引用 toml_datetime::toml_datetime().
|
inlinenoexcept |
尝试解析ISO格式带时区
| view | ISO格式字符串 |
在文件 datetime.hpp 第 1271 行定义.
引用了 parse_ISO_UTC() , 以及 swap().
被这些函数引用 toml_datetime::toml_datetime().
|
inlineconstexprnoexcept |