I have some code as below
GetCustomers = from c in XDoc.Descendants(ns + "customer")
select
new Customer
{
Name = c.Element(ns + "name").Value,
DateOfBirth = Convert.ToDateTime(c.Element(ns + "date-span").Elements(ns + "begin").Any() ? c.Element(ns + "date-span").Element(ns + "begin").Value : DateTime.Now.ToString())
};
the customers date of birth comes in two formats - 01/01/2006 or 2006 (so a full date or just the year). How could i change the DateOfBirth code so if the date in the begin element is 2006 it would change it to 12/12/2006 (so in other words if it finds a
year it keeps the year found but replaces the dd and MM to 12?
Th ...
Go to the complete details ...