I'm retrieving a string like this (04/29/2013 10:00:00 AM) from my config.xml.I want to convert this to DateTime format.How to do this?
I tried followings:
DateTime dtNextrunTimeforExcel = Convert.ToDateTime(str);
and
DateTime dtNextrunTimeforExcel = DateTime.Parse(str);
But, in both the case its saying "string was not recognized as a valid datetime".
Note:I'm writing Windows service with VS2010
Pl. help.
Try using
.ParseExact