Skip to content

Instantly share code, notes, and snippets.

@chrismcg
Created April 6, 2009 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrismcg/90827 to your computer and use it in GitHub Desktop.
Save chrismcg/90827 to your computer and use it in GitHub Desktop.
>> Time.parse('01/31/2009').advance(:months => 1)
=> Sat Feb 28 00:00:00 0000 2009
>> Time.parse('01/31/2009').advance(:months => 1).advance(:months => 1)
=> Sat Mar 28 00:00:00 0000 2009
>> Time.parse('01/31/2009').advance(:months => 2)
=> Tue Mar 31 00:00:00 0100 2009
>> Time.parse('01/31/2009').advance(:months => 3)
=> Thu Apr 30 00:00:00 0100 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment