As another example, you can parse a year_month from a sequence of characters specifying the full month
name and the year, among other things, as follows:
std::chrono::year_month m;
std::istringstream sstrm{"Monday, April 5, 2021"};
std::chrono::from_stream(sstrm, "%A, %B %d, %Y", m);
if (sstrm) {
std::cout << "month: " << m << '\n'; // prints: month: 2021/Apr
}
The format string accepts all conversion specifiers of formatted output except %q and %Q with improved flexibility