C# : Convert datetime from string with different format -


if string 26/01/2011 00:14:00 computer set united state format (am:pm) how convert string datetime? try convert.todatetime() cause error.

as others have said, can use datetime.tryparseexact, seem have european culture format in date. might not hurt make attempt use perform conversion:

cultureinfo engb = new cultureinfo("en-gb");  string datestring; datetime datevalue;  // parse date no style flags. datestring = "26/01/2011 00:14:00"; datetime.tryparseexact(datestring, "g", engb, datetimestyles.none, out datevalue); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -