instance method
beginning_of_quarter
Ruby on Rails 4.1.16
Since v4.0.13Signature
beginning_of_quarter()
Returns a new date/time at the start of the quarter. Example: 1st January, 1st July, 1st October. DateTime objects will have a time set to 0:00.
Source
# File activesupport/lib/active_support/core_ext/date_and_time/calculations.rb, line 88
def beginning_of_quarter
first_quarter_month = [10, 7, 4, 1].detect { |m| m <= month }
beginning_of_month.change(:month => first_quarter_month)
end
Defined in activesupport/lib/active_support/core_ext/date_and_time/calculations.rb line 88
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in DateAndTime::Calculations