Skip to content

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

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.

See also .httpdate #hour #inspect #hash also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0