public Method

Time.rfc2822

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.

Source Code

# File time.rb, line 391
def rfc2822
  sprintf('%s, %02d %s %d %02d:%02d:%02d ',
    RFC2822_DAY_NAME[wday],
    day, RFC2822_MONTH_NAME[mon-1], year,
    hour, min, sec) +
  if utc?
    '-0000'
  else
    off = utc_offset
    sign = off < 0 ? '-' : '+'
    sprintf('%s%02d%02d', sign, *(off.abs / 60).divmod(60))
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.