Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Date._httpdate
(::String str) -> ::Hash[::Symbol, ::Integer]
Date._httpdate(string, limit: 128) → hash
ext/date/date_core.c
View on GitHub ↗
static VALUE
date_s__httpdate(int argc, VALUE *argv, VALUE klass)
{
VALUE str, opt;
rb_scan_args(argc, argv, "1:", &str, &opt);
if (!NIL_P(str)) str = check_limit(str, opt);
return date__httpdate(str);
}
Returns a hash of values parsed from string, which should be a valid HTTP date format:
Example
d = Date.new(2001, 2, 3) s = d.httpdate # => "Sat, 03 Feb 2001 00:00:00 GMT" Date._httpdate(s) # => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"GMT", :offset=>0}
Related: Date.httpdate (returns a Date object).