I am trying to convert a string to Datetime in c#. String datestring= 2013/03/18 10:54:07.679
I tried
DateTime dt=DateTime.ParseExact(datestring, "yyyy/MM/dd HH:mm:ss.fff",null);
The result is {3/18/2013 10:54:07 AM}I tried
DateTime.TryParseExact(datestring,"yyyy/MM/dd HH:mm:ss.fff",CultureInfo.InvariantCulture,DateTimeStyles.None,out dttt);
The result is {3/18/2013 10:54:07 AM}
In both the above cases its ommitting millisecons(679).
How can I convert it to datetime correctly by keeping the milliseconds?
See Question&Answers more detail:os