Getting abit of a problem I only know how to use DateTime to display my results like so:
{
string uri = "http://localhost:8002/Service/HireDate";
XDocument xDoc = XDocument.Load(uri);
var staff = xDoc.Descendants("HireDate")
.Select(n => new
{
StartDate = DateTime.Parse(n.Element("HireFromDate").Value), //this line
EndDate = DateTime.Parse(n.Element("HireToDate").Value), //this line
TotalDaysHired = n.Element("NumberOfDaysHired").Value,
})
.ToList();
dataGrid9.ItemsSource = staff;
}
However this outputs like this in my datagrid:
15/07/2012 00:00:00
27/07/2012 00:00:00
Is there a way to remove the time I just want the date?
So you want to show only the
Datepart of aDateTimeasString? You could useDateTime.ToShortDateString()which is most readable: