Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to apply particular FORMAT of date by using eval?

Tags:

asp.net

I have used following code :

 <asp:HyperLink ID="Time" runat="server"  Text='<%#Eval("CREATED_ON")%>'> </asp:HyperLink>

It will display the date in the format: 11/4/2010 10:52:33 AM

But I want it to display 11/4/2010. How would I do this?

like image 740
Shalni Avatar asked Sep 07 '25 16:09

Shalni


2 Answers

You should be able to use something like this:

<asp:HyperLink ID="lnkCreatedDate" runat="server" Text='<%#Eval("CREATED_ON", "{0:dd/M/yyyy}")%>'> </asp:HyperLink>
like image 77
Kristof Claes Avatar answered Sep 10 '25 05:09

Kristof Claes


You can try this -

<asp:HyperLink ID="lnkCreatedDate1" runat="server" Text='<%# DateTime.Parse(Eval("CREATED_ON").ToString()).ToString("d") %>'> </asp:HyperLink>   
like image 33
Manoj Attal Avatar answered Sep 10 '25 06:09

Manoj Attal