instance method quarter

Ruby on Rails 8.0.4

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

quarter()

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
Source
# File activesupport/lib/active_support/core_ext/date_and_time/calculations.rb, line 166
    def quarter
      (month / 3.0).ceil
    end

Defined in activesupport/lib/active_support/core_ext/date_and_time/calculations.rb line 166 · View on GitHub · Improve this page · Find usages on GitHub

Defined in DateAndTime::Calculations

Type at least 2 characters to search.

↑↓ navigate · open · esc close