Hello,

I store Date in my database ( in sqlserver 2008 my datatype for this field is Date) however when i display the date in front end (ASP.NET C#) i get Date along with Time 12:00 AM as a default time.

I dont want Time to be displayed in my front end. How to over come this problem??

Solution awaited...


cya
Rohan

Recommended Answers

All 5 Replies

DateTime.Today.ToShortDateString();

Use ToShortDateString() Method.

at the time of Binding you can control

<asp id="Label1" runat="server" Label.Text='<%# Eval("CreationDate", "{0:M-dd-yyyy}") %>'>

hope that helps

hii,

jbisono

ToShortDateString() method worked!!!

Thanks a lott......

dnanetwork thanks for your suggestion too!! :)

cya
Rohan

Hii
dnanetwork ,

Even your code helped!! while binding the date field to the gridview !

thanks...

cool :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.