how to convert string "dd.MM.yyyy HH:mm:ss.mmm" to the datetime in c# -


i try convert string type "dd.mm.yyyy hh:mm:ss.mmm" datetime using way below:

datetime result; string c;  tarihsaat[n - 4] = datetime.parseexact(c, "dd.mm.yyyy hh:mm:ss.mmm", cultureinfo.invariantculture); 

but got formatexception error. how can convert it? thanks..

this should it, can't reuse format string pattern twice ("m" in sample), want use "fff" milliseconds. details on custom date , time format strings check msdn.

string c = "15.04.2011 14:32:15.444"; datetime result = datetime.parseexact(c, "dd.mm.yyyy hh:mm:ss.fff",                                        cultureinfo.invariantculture); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -