1

I have created a method which return the time , I want to return the time in RFC 2822 format please suggest how can I achieve this ?

Rajarshi Das
  • 13,633
  • 4
  • 44
  • 60

1 Answers1

9

Simply:

require 'time'

t = Time.now
formatted_time = t.rfc2822  # "Wed, 05 Oct 2011 22:26:12 -0400"

More details.

rony36
  • 3,208
  • 1
  • 29
  • 41