如何在asp.net中更改DataBinder.Eval的日期格式?

Bar*_*hen 35 c# sql-server asp.net

我正在试图弄清楚如何更改日期时间格式,以便只显示日期.

            <asp:Repeater ID="RepeaterActions" runat="server">
            <ItemTemplate>
                <li>
                    <span class="historyDate"><%#DataBinder.Eval(Container.DataItem, "ActionListDate")%></span>
                    <span class="historyName"><%#DataBinder.Eval(Container.DataItem, "LeadActionName")%></span><br />
                    <span class="historyNotes"><%#DataBinder.Eval(Container.DataItem, "ActionListNote")%></span>
                </li>
            </ItemTemplate>
        </asp:Repeater>
Run Code Online (Sandbox Code Playgroud)

我猜它在<%%>之间,但我不确定.

我的代码背后是:

<pre>
        protected void RepeaterActionsFill()
    {

        string sql = @"  select a.ActionListDate, a.LeadListID, 
a.ActionListNote, 
l.LeadActionName
from ActionLists as a
INNER JOIN LeadActions as l
ON a.LeadActionID = l.LeadActionID
where a.LeadListID = " + Convert.ToInt32(Request["id"].ToString());

        RepeaterActions.DataSource = DBUtil.FillDataReader(sql);
        RepeaterActions.DataBind();
    }
</pre>
Run Code Online (Sandbox Code Playgroud)

目前,它看起来像这样:

HTML视图

我正在寻找的是时间戳去那里.

任何帮助表示赞赏.

编辑:

这是我在寻找的东西:

            <asp:Repeater ID="RepeaterActions" runat="server">
            <ItemTemplate>
                <li>
                    <span class="historyDate"><%#DataBinder.Eval(Container.DataItem, "ActionListDate", "{0:M/d/yy}")%></span>
                    <span class="historyName"><%#DataBinder.Eval(Container.DataItem, "LeadActionName")%></span><br />
                    <span class="historyNotes"><%#DataBinder.Eval(Container.DataItem, "ActionListNote")%></span>
                </li>
            </ItemTemplate>
        </asp:Repeater>
Run Code Online (Sandbox Code Playgroud)

Dam*_*ith 51

给出格式例如:

<%# DataBinder.Eval(Container.DataItem, "ActionListDate", "{0:d/M/yyyy hh:mm:ss tt}") %>
Run Code Online (Sandbox Code Playgroud)


Chr*_*ian 26

<%# string.Format("{0:ddd MMM yyyy}", Eval("ActionListDate"))%>