instance method
end_of_quarter
Ruby on Rails 8.0.4
Since v4.0.13Signature
end_of_quarter()
Returns a new date/time at the end of the quarter.
today = Date.today # => Fri, 10 Jul 2015 today.end_of_quarter # => Wed, 30 Sep 2015
DateTime objects will have a time set to 23:59:59.
now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000
Source
# File activesupport/lib/active_support/core_ext/date_and_time/calculations.rb, line 154
def end_of_quarter
last_quarter_month = month + (12 - month) % 3
beginning_of_month.change(month: last_quarter_month).end_of_month
end
Defined in activesupport/lib/active_support/core_ext/date_and_time/calculations.rb line 154
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in DateAndTime::Calculations