I need to serialize / deserialize a datetime into yyyyMMdd format for an XML file. Is there an attribute / workaround I can use for this?
+5
A:
No, there isn't. If it's in that format, then it's not a valid dateTime as far as XML Schema is concerned.
The best you can do is as follows:
[XmlIgnore]
public DateTime DoNotSerialize {get;set;}
public string ProxyDateTime {
get {return DoNotSerialize.ToString("yyyymmdd");}
set {DoNotSerialize = DateTime.Parse("yyyymmdd");}
}
John Saunders
2009-07-13 11:04:27
Thanks, that's what I thought it would be.
ck
2009-07-13 11:06:39