How do I accept MM/DD/YYYY date format in using XmlSerializer?
Posted on 2004-08-18
I am accepting an XML feed from a client. I have created a class for to match it and am attempting to use the XmlSerializer class to automatically convert the feed to a binary format for use. There is a date that is sent over in MM/DD/YYYY format and my call to XmlSerializer.Deserialize is giving me the following error:
String was not recognized as a valid DateTime.
Is there an XmlAttribute I can use to make the class accept this format, or something else I can do? I'm currently using [serial.XmlElementAttribute(DataType="date")], but that is working for MM/DD/YYYY. It is working if on some test cases in which I changed the format to YYYY-MM-DD, but that is not an option for me at this point unless I transform it which does not really make sense for one field.