std::chrono::is_am, std::chrono::is_pm, std::chrono::make12, std::chrono::make24_C++中文网
位置:首页 > C++ 参考手册 >日期和时间工具 > std::chrono::is_am, std::chrono::is_pm, std::chrono::make12, std::chrono::make24
这些函数辅助在 12 时格式与 24 时格式的日之时间之间翻译。
1) 检测 24 时格式时间是否为 a.m. ( ante meridiem ,午前)。
2) 检测 24 时格式时间是否为 p.m. ( post meridiem ,午后)。
3) 返回 24 时格式时间的 12 时等价版本。
4) 返回 12 时格式时间 h 的 24 时等价版本,其中 is_pm 确定时间是否为 p.m. 。
参数
| h | - | 要检测的 12 时或 24 时格式时间 |
| is_pm | - | 确定 12 时格式时间是否为 p.m. |
返回值
1) 0h <= h && h <= 11h。
2) 12h <= h && h <= 23h。
3) 若 h 在范围 [0h, 23h] 内,则返回范围 [1h, 12h] 内的 12 时等价版本。否则返回值未指定。
4) 若 h 在范围 [1h, 12h] 内,则返回范围 [0h, 11h] 内的 24 时等价版本,若 is_pm 为 false ,否则结果在范围 [12h, 23h] 内。否则返回值未指定。