c# - How to parse string in the format "20150129163809" to datetime? -


this question has answer here:

i application need convert string in datetime format below:

var k=    datetime.parse("20150129163809"); 

but throwing error message "string not recognized valid datetime."

but, when

datetime.parse("2015-01-29 16:38:09") 

its working fine...

what wrong?

use parseexact parse well-formatted strings:

var k = datetime.parseexact("20150129163809","yyyymmddhhmmss",cultureinfo.invariantculture); 

datetime.parse limited in capabilities , not try , "guess" format string in.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -