Ruby: convert string to date

date, ruby, string

Solution

You could also use `Date.strptime`:

Date.strptime("{ 2009, 4, 15 }", "{ %Y, %m, %d }")

Problem

In Ruby, what's the best way to convert a string of the format: `"{ 2009, 4, 15 }"` to a Date?

Original source

Related problems