Previous: , Up: Durations   [Contents]


4.3.2 calendarDuration Class

A calendarDuration represents a period of time in variable-length calendar components. For example, years and months can have varying numbers of days, and days in time zones with Daylight Saving Time have varying numbers of hours. A calendarDuration does arithmetic with "whole" calendar periods.

calendarDurations and durations cannot be directly combined, because they are not semantically equivalent. (This may be relaxed in the future to allow durations to be interpreted as numbers of days when combined with calendarDurations.)

d = datetime('2011-03-04 00:00:00')
    ⇒ 04-Mar-2011
cdur = calendarDuration(1, 3, 0)
    ⇒ 1y 3mo
d2 = d + cdur
    ⇒ 04-Jun-2012