Search code examples
asp.netrepeater

How Can I Display My Date Format As Day/Month/Year Instead Of Date And Time In Repeater


How can I display my date format as day/month/year instead of date and time in repeater?
Actually, I'm using this format in repeater:

<%# DataBinder.Eval(Container, "DataItem.DATE1","{0:d}")%>

The result is showing as 2014-12-11T00:00:00+05:30

Please help me to display only the date.


Solution

  • Try: BoundField.DataFormatString Property

    <%# Convert.ToDateTime(Eval("dateTime")).ToString("d") %>
    

    or try

    <%#Eval("dbDate","{0:dd/MM/yyyy}")%>
    

    or try

    String.Format("{0:dd.MM.yyyy}", myDateTimeInstance);