datetime

Methods

Method Reference: datetime.plus

datetime: C = plus (A, B)

Addition for datetime arrays.

C = plus (A, B) is the equivalent of the syntax C = A + B and supports the following operand combinations, in either order.

  • datetime + duration returns a datetime array shifted later by a fixed number of 24-hour days. For a zoned array the shift is applied to the absolute instant, so it is aware of daylight saving time transitions.
  • datetime + calendarDuration returns a datetime array shifted later in calendar units. Whole months (and years) are applied first, clamping the day of month to the last day of the target month when necessary (e.g. 31 January plus one month is 28 February), then whole calendar days, and finally the time-of-day component as an instant.
  • datetime + X, where X is a numeric or logical array, treats the elements of X as a number of fixed 24-hour days.

Adding two datetime arrays is not defined and raises an error. A and B must be size compatible: they can be the same size, one can be scalar, or for every dimension their sizes must be equal or one of them must be 1. Not-A-Time and infinite elements propagate to the result.

Source Code: datetime