c# - cannot convert string to datetime using ParseExact -
I have a string like this in the XML string data file (in 12 hour clock):
expires = "10/27/2014 2:42:57 PM"
I used that value as a member of a class (datetime) in this way Assign to:
General. OEE XPRIZ = Datetime. Parsexact (GSAT attribute ("expires"). Value, "MM / DD / YY HH: MM: SS", Culture Info. Inverteenthalic);
But I'm getting the error 'string not recognized as a valid date time'
What am I doing wrong here?
This should be BTW in the UK, so cultureInfo should be cured
It should be :
"MM / DD / YY H: mm: SSTT"
As you know about tt
For AM / PM, and H
because you have 1-12 hours, not the format 01-12. Think if your seconds and minutes should be s
and m
Comments
Post a Comment