So here is my xml file:
<book>
<title>Book Title</title>
<author>Book Author</author>
<pubDates>
<date format="standard">1991-01-15</date>
<date format="friendly">January 1991</date>
</pubDates>
</book>
I load the data into an XDocument and then extract it from the XDocument and add it to the Book class, but I can’t get the date. I would like to get a friendly date.
Here is what I have:
XDocument xml = XDocument.Load("http://www.mysite.com/file.xml");
List<Book> books = new List<Book>();
books.Add(new Book
{
Title = xml.Root.Element("title").Value,
Author = xml.Root.Element("author").Value,
}
);
How can I get a friendly date?
source
share