I have a class that I serialize/deserialize using XmlSerializer
. This class contains a DateTime
field.
When serialized, the DateTime
Could you try something like this post suggests and make a new string property and XmlIgnore the existing one:
Put [XmlIgnore] on the Time property.
Then add a new property:
[XmlElement(DataType="string",ElementName="Time")]
public String TimeString
{
get { return this.timeField.ToString("yyyy-MM-dd"); }
set { this.timeField = DateTime.ParseExact(value, "yyyy-MM-dd", CultureInfo.InvariantCulture); }
}