Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Datetime problem
Message
General information
Forum:
C#
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01652147
Message ID:
01652148
Views:
47
>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.


DateTime.Parse(),
DateTime.ParseExact()?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform