Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Date#next_year

d.next_year([n=1]) → date

This method is equivalent to d >> (n * 12).

Example
Date.new(2001,2,3).next_year      #=> #<Date: 2002-02-03 ...>
Date.new(2008,2,29).next_year     #=> #<Date: 2009-02-28 ...>
Date.new(2008,2,29).next_year(4)  #=> #<Date: 2012-02-29 ...>

See also Date#>>.

See also #next_month #nth_kday? #next_day #prev_day also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1