|
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 |
| 从时间移动赋值 | |
| constexpr const _NEFORCE date & | date () const noexcept |
| 获取日期部分 | |
| constexpr const _NEFORCE time & | time () const noexcept |
| 获取时间部分 | |
| constexpr time_type | hours () const noexcept |
| 获取小时 | |
| constexpr time_type | minutes () const noexcept |
| 获取分钟 | |
| constexpr time_type | seconds () const noexcept |
| 获取秒 | |
| constexpr date_type | year () const noexcept |
| 获取年份 | |
| constexpr date_type | month () const noexcept |
| 获取月份 | |
| constexpr date_type | day () const noexcept |
| 获取日期 | |
| constexpr bool | has_timezone () const noexcept |
| 检查是否有时区信息 | |
| constexpr int64_t | offset_seconds () const noexcept |
| 获取时区偏移 | |
| constexpr void | clear () noexcept |
| 重置为纪元起始时间 | |
| constexpr bool | equal_to (const datetime &other) const noexcept |
| 相等比较 | |
| constexpr bool | less_than (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 |
| 时间差(秒数) | |
| constexpr string | to_offset_string () const |
| 转换为时区偏移字符串 | |
| constexpr datetime | to_UTC () const noexcept |
| 转换为UTC时间 | |
| constexpr string | to_RFC3339 () const |
| 转换为 RFC 3339 | |
| constexpr bool | try_parse_RFC3339 (const string_view view) noexcept |
| 尝试解析 RFC 3339 | |
| constexpr string | to_RFC1123 () const |
| 转换为 RFC 1123 | |
| constexpr bool | try_parse_RFC1123 (const string_view view) noexcept |
| 尝试解析 RFC 1123 | |
| constexpr string | to_ISO8601 () const |
| 转换为 ISO 8601 | |
| constexpr bool | try_parse_ISO8601 (const string_view view) noexcept |
| 尝试解析 ISO 8601 | |
| constexpr string | to_string () const |
| 转换为简单格式 | |
| constexpr size_t | to_hash () const noexcept |
| 计算哈希值 | |
| constexpr void | swap (datetime &other) noexcept |
| 交换两个日期时间 | |
| Public 成员函数 继承自 iobject< datetime > | |
| constexpr bool | try_parse (const string_view str) noexcept |
| 尝试从字符串解析对象 | |
| Public 成员函数 继承自 istringify< datetime > | |
| constexpr string | to_string () const |
| 转换为字符串 | |
| Public 成员函数 继承自 icomparable< datetime > | |
| constexpr bool | operator== (const datetime &rhs) const noexcept(noexcept(derived().equal_to(rhs))) |
| 相等比较运算符 | |
| constexpr bool | operator!= (const datetime &rhs) const noexcept(noexcept(!(derived().equal_to(rhs)))) |
| 不等比较运算符 | |
| constexpr bool | operator< (const datetime &rhs) const noexcept(noexcept(derived().less_than(rhs))) |
| 小于比较运算符 | |
| constexpr bool | operator> (const datetime &rhs) const noexcept(noexcept(rhs.less_than(derived()))) |
| 大于比较运算符 | |
| constexpr bool | operator<= (const datetime &rhs) const noexcept(noexcept(!(rhs.less_than(derived())))) |
| 小于等于比较运算符 | |
| constexpr bool | operator>= (const datetime &rhs) const noexcept(noexcept(!(derived().less_than(rhs)))) |
| 大于等于比较运算符 | |
| Public 成员函数 继承自 ihashable< datetime > | |
| constexpr size_t | to_ihash () const noexcept(noexcept(derived().to_hash())) |
| 获取对象的哈希值 | |
静态 Public 成员函数 | |
| static constexpr datetime | epoch () noexcept |
| 获取纪元起始时间(1970-01-01 00:00:00 UTC) | |
| static datetime | now () noexcept |
| 获取当前本地时间 | |
| static constexpr datetime | from_UTC (const datetime &utc, const int32_t offset=0) noexcept |
| 从UTC时间转换为本地时间 | |
| static constexpr datetime | parse_RFC3339 (const string_view view) |
| 解析 RFC 3339 | |
| static constexpr datetime | parse_RFC1123 (string_view view) |
| 解析 RFC 1123 | |
| static constexpr datetime | parse_ISO8601 (const string_view view) |
| 解析 ISO 8601 | |
| static constexpr datetime | parse (const string_view view) |
| 解析简单格式 | |
| 静态 Public 成员函数 继承自 iobject< datetime > | |
| static 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 |
|
inlinenodiscardconstexprnoexcept |
获取日期部分
在文件 datetime.hpp 第 935 行定义.
引用了 date().
被这些函数引用 date(), datetime(), datetime(), datetime(), datetime(), datetime(), datetime(), sqlite_prepared_result::get_date(), sqlite_result::get_date(), operator=(), operator=(), parse(), parse_ISO8601(), parse_RFC3339() , 以及 to_RFC1123().
|
inlinenodiscardconstexprnoexcept |
|
inlinestaticnodiscardconstexprnoexcept |
获取纪元起始时间(1970-01-01 00:00:00 UTC)
在文件 datetime.hpp 第 995 行定义.
被这些函数引用 timestamp::timestamp() , 以及 timestamp::to_datetime().
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
staticnodiscardnoexcept |
|
inlinenodiscardconstexprnoexcept |
|
inlinestaticnodiscardconstexpr |
解析简单格式
| view | 格式为 YYYY-MM-DD HH:MM:SS 的字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1426 行定义.
引用了 date(), date::parse(), time::parse(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
|
inlinestaticnodiscardconstexpr |
解析 ISO 8601
| view | ISO 8601 格式字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1384 行定义.
引用了 date(), date::parse(), time::parse(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
被这些函数引用 try_parse_ISO8601().
|
inlinestaticnodiscardconstexpr |
解析 RFC 1123
| view | RFC 1123 格式字符串 |
| value_exception | 格式错误时抛出 |
在文件 datetime.hpp 第 1324 行定义.
引用了 day(), basic_string_view< CharT, Traits >::head(), basic_string_view< CharT, Traits >::remove_prefix(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 year().
被这些函数引用 try_parse_RFC1123().
|
inlinestaticnodiscardconstexpr |
解析 RFC 3339
| view | RFC 3339 格式字符串 |
| value_exception | 格式错误或缺少时区信息时抛出 |
在文件 datetime.hpp 第 1233 行定义.
引用了 date(), hours(), minutes(), date::parse(), time::parse(), sign(), basic_string_view< CharT, Traits >::size(), basic_string_view< CharT, Traits >::substr() , 以及 time().
被这些函数引用 try_parse_RFC3339().
|
inlinenodiscardconstexprnoexcept |
获取秒
在文件 datetime.hpp 第 959 行定义.
被这些函数引用 operator+(), operator+=(), operator-() , 以及 operator-=().
|
inlineconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
获取时间部分
在文件 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_ISO8601(), parse_RFC3339(), time() , 以及 to_RFC1123().
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
转换为时区偏移字符串
在文件 datetime.hpp 第 1167 行定义.
引用了 format(), hours(), minutes() , 以及 sign().
被这些函数引用 to_RFC3339().
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
转换为 RFC 3339
在文件 datetime.hpp 第 1219 行定义.
引用了 to_offset_string().
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexprnoexcept |
转换为UTC时间
在文件 datetime.hpp 第 1203 行定义.
被这些函数引用 from_UTC(), operator-() , 以及 timestamp::timestamp().
|
inlineconstexprnoexcept |
尝试解析 ISO 8601
| view | ISO 8601 格式字符串 |
在文件 datetime.hpp 第 1402 行定义.
引用了 parse_ISO8601() , 以及 swap().
被这些函数引用 toml_datetime::toml_datetime() , 以及 yaml_timestamp::yaml_timestamp().
|
inlineconstexprnoexcept |
尝试解析 RFC 1123
| view | RFC 1123 格式字符串 |
在文件 datetime.hpp 第 1360 行定义.
引用了 parse_RFC1123() , 以及 swap().
|
inlineconstexprnoexcept |
尝试解析 RFC 3339
| view | RFC 3339 格式字符串 |
在文件 datetime.hpp 第 1281 行定义.
引用了 parse_RFC3339() , 以及 swap().
被这些函数引用 toml_datetime::toml_datetime() , 以及 yaml_timestamp::yaml_timestamp().
|
inlinenodiscardconstexprnoexcept |