ASP.Net GridView/Repeater Date Format

To Format Date in GridView or Repeater ItemTemplate in dd-MM-yyyy or any other preferred format use below code

	<asp:Repeater runat="server" ID="rptContractType" OnItemCommand="rptContractType_ItemCommand">
                                            <td style="text-align: center">                                           
                                                <asp:Label ID="lblNewsDate" runat="server"  Text='<%# Convert.ToDateTime(Eval("NewsDate")).ToString("dd-MM-yyyy") %>'></asp:Label>												

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s