boost.png (6897 bytes) Home Libraries People FAQ More

PrevUpHomeNext

Class template first_kday_of_month

boost::date_time::first_kday_of_month — Useful generator functor for finding holidays and daylight savings.

Synopsis

template<typename date_type> 
class first_kday_of_month
  :  : public boost::date_time::year_based_generator< date_type >
{
public:
  // types
  typedef date_type::calendar_type        calendar_type;   
  typedef calendar_type::day_of_week_type day_of_week_type;
  typedef calendar_type::month_type       month_type;      
  typedef calendar_type::year_type        year_type;       
  typedef date_type::duration_type        duration_type;   

  // construct/copy/destruct
  first_kday_of_month(day_of_week_type, month_type);

  // public member functions
  date_type get_date(year_type) const;
  month_type month() const;
  day_of_week_type day_of_week() const;
  virtual std::string to_string() const;
};

Description

Similar to nth_kday_of_month, but requires less paramters

first_kday_of_month construct/copy/destruct

  1. first_kday_of_month(day_of_week_type dow, month_type m);

    Parameters

    dow

    The day of week, eg: Sunday, Monday, etc

    m

    The month of the year, eg: Jan, Feb, Mar, etc

first_kday_of_month public member functions

  1. date_type get_date(year_type year) const;
  2. month_type month() const;
  3. day_of_week_type day_of_week() const;
  4. virtual std::string to_string() const;

    Returns a string formatted as "M4.1.0" ==> 1st Sunday in April.

Copyright © 2001-2005 CrystalClear Software, Inc

PrevUpHomeNext