Method: Time#rfc2822
- Defined in:
- lib/time.rb
#rfc2822 ⇒ Object Also known as: rfc822
Returns a string which represents the time as date-time defined by RFC 2822:
day-of-week, DD month-name CCYY hh:mm:ss zone
where zone is [+-]hhmm.
If self is a UTC time, -0000 is used as zone.
require 'time'
t = Time.now
t.rfc2822 # => "Wed, 05 Oct 2011 22:26:12 -0400"
You must require ‘time’ to use this method.
675 676 677 |
# File 'lib/time.rb', line 675 def rfc2822 strftime('%a, %d %b %Y %T ') << (utc? ? '-0000' : strftime('%z')) end |