I consume a web service which returns me some dates as string, and I use DateTime.Parse
to get the correspondente DateTime
objects. It is working, but I'm afraid my usage of DateTime.Parse
may be vulnerable to bugs caused by different locale settings. The date returned is in the following format:
2014-04-24T00:00:00
The code I use to parse it:
DateTime d = DateTime.Parse(strValue);
Is there some way (such as passing a format provider, or using another method) in which I guarantee that my parsing routine will work regardless of the machine locale settings?