This works for me in R:
# Setting up the first inner while-loop controller, the start of the next water year NextH2OYear <- as.POSIXlt(firstDate) Next
Here is you can add 1 month to a date in R, using package lubridate:
lubridate
library(lubridate) x <- as.POSIXlt("2010-01-31 01:00:00") month(x) <- month(x) + 1 >x [1] "2010-03-03 01:00:00 PST"
(note that it processed the addition correctly, as 31st of Feb doesn't exist).