Skip to main content

months_between

Function months_between 

Source
pub fn months_between(a_nanos: i64, b_nanos: i64) -> i64
Expand description

The number of complete calendar months from instant a to instant b (signed; negative when b precedes a). A month is complete only when b reaches at least a + k months under the same end-of-month-clamping, time-of-day-preserving rule as add_span — so Jan 15 → Mar 14 is 1 month (not 2), Jan 31 → Feb 28 (non-leap) is a full month, and one hour short of a month is 0.