We are creating a system with different locales. I can say all of the .net locales that can be found here : https://dotnetfiddle.net/e1BX7M
I googled a lot and datetime.parseexact or datetime.parse is only for one specific format, for example dd/mm/yyyy or mm/dd/yyyy.
Examples : When I use something like this
Date.Parse(Request.QueryString("asofdate"), CultureInfo.CurrentCulture)
and Request.QueryString("asofdate") format is dd/mm/yyyy, the system throws exception, otherwise when the format is mm/dd/yyyy works fine.
I also tried by using :
Date.Parse(Request.QueryString("asofdate"), CultureInfo.CurrentCulture)
How to handle all formats into one function? Do I have to use tryparse 10 times instead of using one integrated function from Date structure?
EDIT: The question : Is it possible to reduce code from tryparse (one format) tryparse ( second format) tryparse (third format) by using one line of code.