Conversion of string to datetime with specific format

Asked

Viewed 570 times

2

I have a string in the following format: 16Mar2009(mon), but I’m not getting to convert into datetime.

 string format = "dMMMyyyy(dd)";
 DateTime dt = DateTime.ParseExact("16Mar2009(mon)", format,CultureInfo.InvariantCulture);

Returns the following error:

String was not recognized as a Valid Datetime.

1 answer

2


Browser other questions tagged

You are not signed in. Login or sign up in order to post.