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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class date_duration

boost::gregorian::date_duration — Durations in days for gregorian system.


// In header: <boost/date_time/gregorian/greg_duration.hpp>

class date_duration :
  public boost::date_time::date_duration< date_duration_rep >
  // types
  typedef base_type::duration_rep duration_rep;

  // construct/copy/destruct
  explicit date_duration(duration_rep = 0);
  date_duration(const date_duration &);
  date_duration(const base_type &);

  // public member functions
  bool operator==(const date_duration &) const;
  bool operator!=(const date_duration &) const;
  bool operator<(const date_duration &) const;
  bool operator>(const date_duration &) const;
  bool operator<=(const date_duration &) const;
  bool operator>=(const date_duration &) const;
  date_duration & operator-=(const date_duration &);
  date_duration & operator+=(const date_duration &);
  date_duration operator-() const;
  date_duration & operator/=(int);

  // public static functions
  static date_duration unit();


date_duration public construct/copy/destruct

  1. explicit date_duration(duration_rep day_count = 0);
    Construct from a day count.
  2. date_duration(date_time::special_values sv);
    construct from special_values
  3. date_duration(const date_duration & other);
    Copy constructor.
  4. date_duration(const base_type & other);
    Construct from another date_duration.

date_duration public member functions

  1. bool operator==(const date_duration & rhs) const;
  2. bool operator!=(const date_duration & rhs) const;
  3. bool operator<(const date_duration & rhs) const;
  4. bool operator>(const date_duration & rhs) const;
  5. bool operator<=(const date_duration & rhs) const;
  6. bool operator>=(const date_duration & rhs) const;
  7. date_duration & operator-=(const date_duration & rhs);
    Subtract another duration <ndash></ndash> result is signed.
  8. date_duration & operator+=(const date_duration & rhs);
    Add a duration <ndash></ndash> result is signed.
  9. date_duration operator-() const;
    unary- Allows for dd = -date_duration(2); -> dd == -2
  10. date_duration & operator/=(int divisor);
    Division operations on a duration with an integer.

date_duration public static functions

  1. static date_duration unit();
    Returns the smallest duration <ndash></ndash> used by to calculate 'end'.