I have been using below to regex patterns for dd/mm/yyyy and mm/dd/yyyy patterns:
"(?:0?[0-9]|1[0-2])(\/|-|\.)(?:0?[0-9]|1[0-9]|2[0-9]|3[0-1])\1[0-9]{2,4}",
"(?:0?[0-9]|1[0-9]|2[0-9]|3[0-1])(\/|-|\.)(?:0?[0-9]|1[0-2])\1[0-9]{2,4}"
I have placed these patterns in a json file. I am using tryParseExact() to parse the date. Now the problem is when i want to validate dates like:
6/24/2015
22.06.2014
36-35-24
it is picking "22.06.2014" as "2.06.2015" and "36-35-24" as "6-35-24". I don't know where i have gone wrong :(