I want to cast in C# a String
to DateTime
.
My String contains: String input = "2012-07-31T00:00:00.000+0200"
and i used the following pattern: String datePattern = "yyyy-MM-dd%HH:mm:ss.fffz";
MyDateTime myDate = new DateTime();
MyDateTime myDate = DateTime.ParseExact(input, datePattern, null);
And i am getting the following error: String was not recognized as a valid DateTime.
Was pretty sure, because i am not sure how to solve this 'T'
and which Timezone i should use.
There are three variants of it at the msdn side.
Which one i need to use, or can i create my own one? Any suggestions?