I've the following simple class;
Birthdays
{
public DateTime DateOfBirth {get;set;}
public string Name {get;set;}
}
I then serialise my object to Xml using;
try
{
XmlSerializer serializer = new XmlSerializer(obj.GetType());
using (MemoryStream ms = new MemoryStream())
{
XmlDocument xmlDoc = new XmlDocument();
serializer.Serialize(ms, obj);
ms.Position = 0;
xmlDoc.Load(ms);
return xmlDoc;
}
}
catch (Exception e)
{
....
}
The problem I have is that when the Xml is returned the DateOfBirth format is like 2012-11-14T00:00:00 and not 2012-11-14.
How can I override it so that I'm only returning the date part ?