Skip to content

Instantly share code, notes, and snippets.

@hamakn
Created March 28, 2013 11:37
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 hamakn/5262528 to your computer and use it in GitHub Desktop.
Save hamakn/5262528 to your computer and use it in GitHub Desktop.
1ヶ月を足す、とは
[1] pry(main)> require "active_support/time"
=> true
[2] pry(main)> Time.parse("2013-03-31").next_month
=> 2013-04-30 00:00:00 +0900
re.pl$ use DateTime
re.pl$ DateTime->new(year => 2013, month => 3, day =>31)->add( months => 1)->ymd;
"2013-05-01"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment