std::formatter<std::chrono::hh_mm_ss>

Header: <chrono>

Specialization of std::formatter that defines formatting rules for a std::chrono::hh_mm_ss.

# Declarations

template< class CharT >
struct formatter<std::chrono::hh_mm_ss, CharT>;

(since C++20)

# Example

#include <chrono>
#include <format>
#include <iostream>
using namespace std::literals;
 
int main()
{
    std::chrono::hh_mm_ss c{16h + 32min + 10s};
 
    std::cout << "%R: " << std::format("{:%R}", c) << '\n'
              << "%T: " << std::format("{:%T}", c) << '\n';
}

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
P2372R3C++20formatter used the global locale or passed localedefault “C” locale is used when L is absent

# See also