Date arithmetics

Many different operations may be performed with the dates, however not all of them make sense. For example, multiplying a date by a number is an invalid operation, even though multiplying either of the time span classes by a number is perfectly valid.

Here is what can be done:

Addition |
a wxTimeSpan or wxDateSpan can be added to wxDateTime resulting in a new wxDateTime object and also 2 objects of the same span class can be added together giving another object of the same class. |
---|---|

Subtraction |
the same types of operations as above are allowed and, additionally, a difference between two wxDateTime objects can be taken and this will yield wxTimeSpan. |

Multiplication |
a wxTimeSpan or wxDateSpan object can be multiplied by an integer number resulting in an object of the same type. |

Unary minus |
a wxTimeSpan or wxDateSpan object may finally be negated giving an interval of the same magnitude but of opposite time direction. |

For all these operations there are corresponding global (overloaded) operators and also member functions which are synonyms for them: Add(), Subtract() and Multiply(). Unary minus as well as composite assignment operations (like ) are only implemented as members and Neg() is the synonym for unary minus.

ymasuda 平成17年11月19日