如何在RSS feed pubDate字段中显示没有时间的日期?

时间:2014-10-16 06:11:10

标签: c# asp.net rss

我在C#中创建了一个rss版本2页面(rssfeed.aspx).Below是我试过的代码

    <?xml version="1.0" encoding="UTF-8" ?>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RSSFeed.aspx.cs" Inherits="RSSFeed" ContentType="text/xml" %>
<asp:repeater id="rptrRSSFeed" runat="server">
                <HeaderTemplate>
                    <rss version="2.0">
                        <channel>
                        <title>PA Office of Attorney General Press RSS Feed</title>
                        <description>The latest press releases from the PA Office of Attorney General.</description>
                        <copyright>(c) 2007, PA Office of Attorney General</copyright>
                </HeaderTemplate>
                <ItemTemplate>
                    <item>
                        <title><%#RemoveIllegalCharacters(DataBinder.Eval(Container.DataItem, "Title")) %></title>
                        <link><%# Request.Url.Scheme + "://" + Request.Url.Authority + Request.ApplicationPath.TrimEnd('/') + "/"+"Media_and_Resources/Press_Releases/Press_Release/?pid="+ DataBinder.Eval(Container.DataItem, "Id")%></link>
                        <pubDate><%#String.Format("{0:ddd, d MMM yyyy}",DateTime.Parse(DataBinder.Eval(Container.DataItem, "ReleaseDate").ToString())) %></pubDate>
                        <description><%#RemoveIllegalCharacters(DataBinder.Eval(Container.DataItem,"Description"))%></description>
                    </item>
                </ItemTemplate>
                <FooterTemplate>
                    </channel>
            </rss>
                </FooterTemplate>
            </asp:repeater>

但是pubdate以日期时间格式显示。我只想要那里的日期部分。我如何在RSS中实现这一点?

以下是在IE中浏览此页面的图像

enter image description here

0 个答案:

没有答案