it's not ommitting you are just checking through debugger and debugger shows it using AM or PM ,it doenot show milliseconds part.
Try This:
DateTime dt=DateTime.ParseExact(datestring, "yyyy/MM/dd HH:mm:ss.fff",null);
Console.WriteLine(dt.ToString("yyyy/MM/dd HH:mm:ss.fff"));
EDIT: from your comment But I need the answer in Datetime instead of string
You have already the DateTime including MilliSeconds
just debugger is not showing because
(As mentioned in comment by Ant P
) Debugger calls the Parameterless overload of ToString()
method which shows the DateTime
without MilliSeconds.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…