Getting RSS Feed Dates with Ruby

Author:  MikeW Date: 2015-07-20T00:26:13+00:00

How do you get a rfc 3339 or rfc822 date in Ruby? Why do you want either one? lol. Well, you need these specially formatted dates for Atom or RSS2 syndication feeds. To get the properly formatted dates for current time, use:

Time.now.to_datetime.rfc3339
    Time.now.to_datetime.rfc822

Or if you have a date object named dateVar you can use:

dateVar.to_datetime.rfc3339
    dateVar.to_datetime.rfc822