Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards


Class template ostream_ymd_formatter

boost::date_time::ostream_ymd_formatter — Convert ymd to a standard string formatting policies.


// In header: <boost/date_time/date_formatting_locales.hpp>

template<typename ymd_type, typename facet_type, typename charT = char> 
class ostream_ymd_formatter {
  // types
  typedef ymd_type::month_type                         month_type;          
  typedef ostream_month_formatter< facet_type, charT > month_formatter_type;
  typedef std::basic_ostream< charT >                  ostream_type;        
  typedef std::basic_string< charT >                   foo_type;            

  // public static functions
  static void ymd_put(ymd_type, ostream_type &, const facet_type &);


ostream_ymd_formatter public static functions

  1. static void ymd_put(ymd_type ymd, ostream_type & os, const facet_type & f);
    Convert ymd to a standard string formatting policies.

    This is standard code for handling date formatting with year-month-day based date information. This function uses the format_type to control whether the string will contain separator characters, and if so what the character will be. In addtion, it can format the month as either an integer or a string as controled by the formatting policy