Im using a webservice that needs a datetime in the following format “2010-12-24”
I have the string to parse in the same “way” but as said, its a String.
string myDate = "2010-12-24";
How can i parse it so that it gets the same format?
Have tried using : DateTime.Parse(mystring);
but this gives me a colon separated format.
Use
DateTime.ParseExact, providing a custom format string:This will throw an exception if the input string cannot be parsed – you may want to use
DateTime.TryParseExactwhich will return true if successful.