Mohit Sharma

Mohit Sharma

  • NA
  • 1
  • 7.3k

Date time Formate in Datagrid ItemTemplate

Dec 3 2008 5:58 AM
Hi
can any one help me? I have a datetime field in a SQL Server 5.0 database that is bound to a DataGrid Item template.
I really only want to display the time portion of the field i.e. hh:mm:ss. I need to specify a custom format specifier
but have not been able to find any specific examples that fit my circumstance.

<asp:TemplateField HeaderText="Created Date">
    <HeaderStyle Width="10%" />
        <ItemStyle ForeColor="#ffffcc" HorizontalAlign="center" />
            <ItemTemplate>
                <%# DataBinder.Eval(Container.DataItem, "Time").ToString("hh:mm:ss") %>
            </ItemTemplate>
        </asp:TemplateField>

Answers (1)