Formatting a datetime column

D

David

I am using .Net 2.0 and VS2005 with SQL server db. The datetime columns on
SQL have the date and time in them. How can I display just the short date
format (e.g. a datetime of 10/19/2006 11:23:57 AM to show as just
10/19/2006)? I do not want to use the SQL CONVERT on the query because it
affects the sorting of the column in a GridView. If I leave the date and
time together, I get the correct sort. Below is a sample of my textbox on
the GridView column:

<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("updated_datetime")
%>'></asp:TextBox>

Thank you.

David
 
D

David

Thanks. Do you need htmlencode="false" when you do this inside of the
BIND() ?

David

"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> wrote in message news:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top