End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Time#httpdate
httpdate
lib/time.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.0.5/lib/time.rb, line 706
def httpdate
t = dup.utc
sprintf('%s, %02d %s %0*d %02d:%02d:%02d GMT',
RFC2822_DAY_NAME[t.wday],
t.day, RFC2822_MONTH_NAME[t.mon-1], t.year < 0 ? 5 : 4, t.year,
t.hour, t.min, t.sec)
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.