as.Date("2013-01-31") + 1 month
will be "2013-02-28"
. If number n
is negative, the months will be subtracted.AddMonths(x, n, ceiling = TRUE)
Year
, Month
, etc.AddMonths(as.Date("2013-01-01"), 10)
AddMonths(as.Date("2013-01-01"), -5)
AddMonths(201301, 3)
AddMonths(201301, -5)
AddMonths(as.Date("2013-01-31"), 1)
AddMonths(as.Date("2013-01-31"), -2)
AddMonths(as.Date(c("2014-10-12","2013-01-31","2011-12-05")), 3)
Run the code above in your browser using DataLab