Parse Date string in Ruby

Viewed 39055

I have a String 20120119 which represents a date in the format 'YYYYMMDD'.

I want to parse this string into a Ruby object that represents a Date so that I can do some basic date calculation, such as diff against today's date.

I am using version 1.8.6 (requirement).

1 Answers
Related