# gregorian::date_duration

Overall Index -- Gregorian Index -- Posix Time Index

### Date Documentation

Header -- Construction -- Accessors -- Operators

## Introduction

The class boost::gregorian::date_duration is a simple day count used for arithmetic with gregorian::date. A duration can be either positive or negative.
boost::gregorian::date_duration は，gregorian::dateの演算で使うシンプルな日数を表すクラスである。

## Header

    #include "boost/date_time/gregorian/gregorian.hpp" //include all types plus i/o
    or
    #include "boost/date_time/gregorian/gregorian_types.hpp" //no i/o just types

## Construction

Syntax | Description | Example
--- | --- | ---
date_duration(long) | 日数を生成 | date_duration dd(3); //3 日

## Accessors

Syntax | Description | Example
--- | --- | ---
long days() const | 日数を取得 | date_duration dd(3); dd.days() --> 3
bool is_negative() const | 日数が0より小さいときtrue | date_duration dd(-1); dd.is_negative() --> true
static date_duration unit() | duration type の取りうる最小単位を返す | date_duration::unit() --> date_duration(1)

## Operators

Syntax | Description | Example
--- | --- | ---
operator==, operator!=, operator>, operator< operator>=, operator<= | サポートする比較演算子 | dd1 == dd2, etc
date_duration operator+(date_duration) const | 日数を加算する | date_duration dd1(3); date_duration dd2(5); date_duration dd3 = dd1 + dd2;
date_duration operator-(date_duration) const | 日数の差を取る | date_duration dd1(3); date_duration dd2(5); date_duration dd3 = dd1 - dd2;