CppDS.com

C++ 98 11 14 17 20 手册

std::chrono::operator<< (std::chrono::time_of_day)

来自cppreference.com
< cpp‎ | chrono‎ | time of day
 
 
工具库
通用工具
日期和时间
函数对象
格式化库 (C++20)
(C++11)
关系运算符 (C++20 中弃用)
整数比较函数
(C++20)
swap 与类型运算
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
常用词汇类型
(C++11)
(C++17)
(C++17)
(C++17)
(C++17)

初等字符串转换
(C++17)
(C++17)
 
日期和时间工具
(C++11)
(C++11)
当天时刻
(C++20)



(C++20)(C++20)(C++20)(C++20)
时钟
(C++20)
                                             
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
日历
(C++20)
(C++20)
(C++20)
(C++20)
(C++20)
时区
(C++20)
(C++20)
(C++20)
(C++20)
C 风格日期和时间
 
 
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::hours>& t);
(1)
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::minutes>& t);
(2)
template< class CharT, class Traits >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::seconds>& t);
(3)
template< class CharT, class Traits, class Rep, class Period >

std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os,

           const std::chrono::time_of_day<std::chrono::duration<Rep, Period>>& t);
(4)

按照下表所指定的格式字符串,输出 t 到流 os 中。

重载 12 小时格式 24 小时格式
(1) "%I%p" "%H00"
(2) "%I:%M%p" "%H:%M"
(3-4) "%I:%M:%S%p" "%H:%M:%S"

格式指定符的含义是:

格式
指定符
解释
%H 将时( 24 小时时钟)写作十进制数。若结果仅有一位,则加上前缀 0 。
%I 将时( 12 小时时钟)写作十进制数。若结果仅有一位,则加上前缀 0 。
%M 将分写作十进制数。若结果仅有一位,则加上前缀 0 。
%S 将秒写作十进制数。若秒数小于 10 ,则向结果加上前缀 0 。

若输入的精度不能准确地以秒表示,则格式为定点格式的十进制浮点数和匹配输入精度的精度
(或若不能在 18 位小数内转换完浮点十进制秒数,则为微秒精度)。按照本地环境本地化小数点的字符。

%p 写与 12 小时时钟关联的 AM/PM 记号的本地环境等价形式。

返回值

os

关闭