get next/previous month from a Time object

Ruby on Rails

Note: This only works in Rails (Thanks Steve!) but I’m keeping it here in case others are using Rails and wish to use these more intuitive methods.

Super simple – thank you Ruby on Rails!

Time.now + 1.month

Time.now - 1.month  

Or, another option if it’s in relation to the current time (Rails 3+ only).

1.month.from_now

1.month.ago

Leave a Comment