datetime.between
datetime: D = between (A, B)
datetime: D = between (A, B, components)
Calendar difference between two datetime arrays.
D = between (A, B) returns a
calendarDuration array holding the calendar difference from each
element of A to the corresponding element of B. The result is
signed (it is negative where B precedes A) and is expressed in
whole calendar units plus a leftover time, taking month lengths and
daylight saving time into account. A and B must be the same
size or one of them must be scalar. Not-A-Time elements yield NaN.
D = between (A, B, components) expresses
each difference using only the requested calendar components (see
caldiff). The default is {'Years', 'Months', 'Days',
'Time'}.
Source Code: datetime
between gives the calendar difference between two datetimes, broken into years, months and days.
between (datetime (2024, 1, 15), datetime (2025, 3, 20))
ans = calendarDuration 1y 2mo 5d