Short question. I am trying to convert a string into Date (to put it later into INSERT command). My problem is that the string I am reading is always different (there is no rule what format it is going to be – as this is user-dependent).
I found such piece of code on the stackoverflow:
DateTime myDate =
DateTime.ParseExact("2009-05-08 14:40:52,531",
"yyyy-MM-dd HH:mm:ss,fff",
System.Globalization.CultureInfo.InvariantCulture)
but in my case it will not work as I don’t know what kind of format I am going to import.
Is there any universal import function which checks all known formats? If now how should I write it? (please give me some hints).
Thanks for any tips and hints in advance,
Pete
No this is not possible however you may define possible
formatsin an array and pass it toParseExactorTryParseExactmethod.