std::formatter<std::chrono::month_day>
Min standard notice:
Header: <chrono>
Specialization of std::formatter that defines formatting rules for std::chrono::month_day.
# Declarations
template< class CharT >
struct formatter<std::chrono::month_day, CharT>;
(since C++20)
# Example
#include <chrono>
#include <format>
#include <iostream>
int main()
{
using namespace std::chrono_literals;
constexpr std::chrono::month_day md{std::chrono::February / 29d};
std::cout << "%B: " << std::format("{:%B}", md) << '\n'
<< "%d: " << std::format("{:%d}", md) << '\n';
}
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| P2372R3 | C++20 | formatter used the global locale or passed locale | default “C” locale is used when L is absent |