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
ext/date/date_core.c
View on GitHub ↗
static VALUE
date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
{
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
check_limit(str, opt);
return date__rfc2822(str);
}
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).