Method: DateAndTime::Calculations#quarter

Defined in:
activesupport/lib/active_support/core_ext/date_and_time/calculations.rb

#quarterObject

Returns the quarter for a date/time.

Date.new(2010, 1, 31).quarter  # => 1
Date.new(2010, 4, 12).quarter  # => 2
Date.new(2010, 9, 15).quarter  # => 3
Date.new(2010, 12, 25).quarter # => 4


166
167
168
# File 'activesupport/lib/active_support/core_ext/date_and_time/calculations.rb', line 166

def quarter
  (month / 3.0).ceil
end