Hi All,
i have a string say "31-02-2010" now i want to check that wheather this date is valid date or not . what is the best way to do it?
so i need a method which i operate on string which returns true if date is valid and false if it's invalid.
Hi All,
i have a string say "31-02-2010" now i want to check that wheather this date is valid date or not . what is the best way to do it?
so i need a method which i operate on string which returns true if date is valid and false if it's invalid.
Date class has a method to do that
require 'date'
begin
Date.parse("31-02-2010")
rescue
#do something if invalid
end