How do I create a Ruby date object from a string?

Viewed 79213

How do I create a Ruby date object from the following string?

DD-MM-YYYY
7 Answers

If you have control over the format of the date in the string, then Date.parse works fine internationally with strings in YYYY-MM-DD (ISO 8601) format:

Date.parse('2019-11-20')
Related