std::formatter<std::chrono::month_day>

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

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

# See also