add()
and subtract()
add respectively subtract a duration to/from a DateTime object.
This is calculated e.g. as follows:
- 31.01.2017 + 1 month = 31.02.2017
- The resulting date 31.02.2017 is normalized to 03.03.2017.
For a deeper understanding of how you can calculate with DateTime objects, refer to DateTime Arithmetics.