Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将pubDate RSS中的字符串日期转换为dd/MM/yyyy hh:MM windows phone 8.1_C#_Xaml_Windows Phone 8 - Fatal编程技术网

C# 将pubDate RSS中的字符串日期转换为dd/MM/yyyy hh:MM windows phone 8.1

C# 将pubDate RSS中的字符串日期转换为dd/MM/yyyy hh:MM windows phone 8.1,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我正在尝试在文件RSSFeed.cs中为windows phone开发rss阅读器 有: 名称空间RSSReader { [XmlRoot(“rss”)] 公共类RSSFeed { [XmlArray(“通道”)] [XmlArrayItem(“项目”)] 公共列表所有{get;set;} } 公共类RSSItem { [XmlElement(“标题”)] 公共字符串标题{get;set;} [XmlElement(“描述”)] 公共字符串说明{get;set;} [XmlElement(“链接

我正在尝试在文件RSSFeed.cs中为windows phone开发rss阅读器 有:

名称空间RSSReader
{
[XmlRoot(“rss”)]
公共类RSSFeed
{
[XmlArray(“通道”)]
[XmlArrayItem(“项目”)]
公共列表所有{get;set;}
}
公共类RSSItem
{
[XmlElement(“标题”)]
公共字符串标题{get;set;}
[XmlElement(“描述”)]
公共字符串说明{get;set;}
[XmlElement(“链接”)]
公共字符串链接{get;set;}
[XmlElement(“发布日期”)]
公共字符串日期{get;set;}
}
}
rss中的pubDate格式如下所示: 2014年12月2日星期二20:48:00+0200

但我希望它是例如: 2014年12月2日23:57查看C#的自定义日期和时间格式字符串:

使用
DateTime.TryParseExact

将其输出为所需的格式

namespace RSSReader
{
[XmlRoot("rss")]
public class RSSFeed
{
    [XmlArray("channel")]
    [XmlArrayItem("item")]
    public List<RSSItem> All { get; set; }
}

public class RSSItem
{
    [XmlElement("title")]
    public string Title { get; set; }

    [XmlElement("description")]
    public string Description { get; set; }

    [XmlElement("link")]
    public string Link { get; set; }

    [XmlElement("pubDate")]
    public string Date { get; set; }
}
}