Hi everybody,
This line of code is failing for one client
parameter.Value = Convert.ToDateTime(parameterValue);
but works fine for me.
The value is "06/21/2017 11:30:56".
I suspect (and it's very likely) that this client's locale is Spanish, so the date would not be properly recognized.
The question is - how should I adjust the code above? I assume that the date will always come in US locale, but I can not guarantee this 100% for sure. I also can not demand that the calling application will send the date in ISO format.
So, what is the best solution here?
Thanks in advance.
Found suggestion to use
Convert.ToDateTime(parameterValue, new CultureInfo("en-US"))
so, I'll try that.
If it's not broken, fix it until it is.
My Blog