![](/img/trans.png)
[英]FormatException: The string was not recognized as a valid DateTime. There is an unknown word starting at index 0
[英]The string was not recognized as a valid DateTime. There is an unknown word starting at index 26
我正在研究RSS的XML提要,我想按提要的發布日期和時間對提要進行排序。 由於采用了不同的RSS提要,因此它們具有不同的數據和時間格式。
例如
Sat, 23 Mar 2013 23:19:54 GMT
Sat, 23 Mar 2013 23:19:54 EDT
Sat, 23 Mar 2013 23:19:54 -0400
我想將它們轉換為本地時間,然后對其進行排序。
var rssFeed = from el in doc.Elements("rss").Elements("channel").Elements("item")
select new
{
Title = el.Element("title").Value,
Link = el.Element("link").Value,
Description = el.Element("description").Value,
PubDate = DateTime.Parse(el.Element("pubDate").Value, null,
DateTimeStyles.None)
};
請讓我知道如何進行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.