Skip to content

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

class method

Date.httpdate

(::String str, ?::Integer start) -> ::Date
Date.httpdate(string = 'Mon, 01 Jan -4712 00:00:00 GMT', start = Date::ITALY, limit: 128) → date

Returns a new Date object with 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) # => #<Date: 2001-02-03>

See:

Related: Date._httpdate (returns a hash).

See also #httpdate ._httpdate ._iso8601 .gregorian_leap? also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0