LoginSignup
0
0

More than 5 years have passed since last update.

Railsのmonth gemでbeginning_of_monthを使う方法

Last updated at Posted at 2018-12-19

monthというgemがあります(GitHub)

月のはじめの日や終わりの日を取得するbeginning_of_monthend_of_monthは、
Month gemではそれぞれstart_date, end_dateになっているので注意する

this_month = Month.new(2018,12)

this_month.start_date #月初
=> Sat, 01 Dec 2018

this_month.end_date #月末
=> Mon, 31 Dec 2018
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0