c# - DateTime.ParseExact not working at all, why? -
i attempting parse following string datetime object in c#:
datetime.parseexact("20101108 230125", "yyyymmdd hhmmss", null) although value looks correct parseexact method keeps giving me following:
string not recognized valid datetime.
can tell me why , how can parse above string without having manual way? isn't parseexact supposed kind of occasion?
you got format hours wrong, should uppercase:
datetime.parseexact("20101108 230125","yyyymmdd hhmmss", null) lowercase hh specifies time uses 12-hour clock (with am/pm). uppercase hh 24 hour clock time.
for detailed info, check documentation of custom datetime format strings.
Comments
Post a Comment