Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Date._rfc2822

Date._rfc2822(string, limit: 128) → hash

Returns a hash of values parsed from string, which should be a valid RFC 2822 date format:

Example
d = Date.new(2001, 2, 3)
s = d.rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000"
Date._rfc2822(s)
# => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"+0000", :offset=>0}

See argument limit.

Related: Date.rfc2822 (returns a Date object).

See also .parse .rfc2822 ._parse ._rfc3339 also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0