Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Time.httpdate

httpdate(date)

Parses date as an HTTP-date defined by RFC 2616 and converts it to a Time object.

ArgumentError is raised if date is not compliant with RFC 2616 or if the Time class cannot represent specified date.

See httpdate for more information on this format.

Example
require 'time'

Time.httpdate("Thu, 06 Oct 2011 02:26:12 GMT")
#=> 2011-10-06 02:26:12 UTC

You must require ‘time’ to use this method.

See also #httpdate .at .iso8601 .json_create also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0