-1
   DateTime x = DateTime.ParseExact("2017_10_16 13:52:03.112","yyyy_MM_dd HH:mm:ss.fff", null);
   Console.WriteLine(x);
   "10/16/2017 1:52:03 PM"

It gives output as "10/16/2017 1:52:03 PM" Here I am missing the milliseconds 112. I have looked into many online posts but it does not work for me.

haripds
  • 17
  • 2
  • 5

1 Answers1

4

What you have is correct. Only Console.WriteLine(x); does not show you milliseconds by default.

If you ask for this: Console.WriteLine(x.ToString("fff")); you will see your milliseconds

trailmax
  • 34,305
  • 22
  • 140
  • 234