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 ?
Asked
Active
Viewed 1,979 times
1

Rajarshi Das
- 11,778
- 6
- 46
- 74
-
One of the practical purpose of formatting in rfc2822 is 'If-Modified-Since' HTTP header. http://stackoverflow.com/questions/13593796/if-modified-since-date-format – woto Dec 03 '14 at 16:53
1 Answers
9
Simply:
require 'time'
t = Time.now
formatted_time = t.rfc2822 # "Wed, 05 Oct 2011 22:26:12 -0400"

rony36
- 3,277
- 1
- 30
- 42