I have a string: \"31-02-2010\" and want to check whether or not it is a valid date. What is the best way to do it?
\"31-02-2010\"
I need a method which which returns
You can try the following, which is the simple way:
"31-02-2010".try(:to_date)
But you need to handle the exception.