Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Time#httpdate
() -> ::String
httpdate
lib/time.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/time.rb, line 744
def httpdate
getutc.strftime('%a, %d %b %Y %T GMT')
end
Returns a string which represents the time as RFC 1123 date of HTTP-date defined by RFC 2616:
day-of-week, DD month-name CCYY hh:mm:ss GMT
Note that the result is always UTC (GMT).
Example
require 'time' t = Time.now t.httpdate # => "Thu, 06 Oct 2011 02:26:12 GMT"
You must require ‘time’ to use this method.