instance method quarter

Ruby on Rails edge

Since v7.1.6

Available in: v7.1.6 v7.2.4 v8.0.5.1 v8.1.4 edge

Signature

quarter()

Returns the quarter for a date/time.

“‘ruby 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 202
    def quarter
      (month / 3.0).ceil
    end

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

Defined in DateAndTime::Calculations

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close