datagrid and datetime field

G

Guest

Is there a way to truncate the Sql Server datetime field when displaying in a
datagrid? I get the date and time, I only want date displayed.
It's a bound column:
<asp:BoundColumn HeaderStyle-CssClass="gridtext" HeaderStyle-Wrap=False
ItemStyle-CssClass="gridtext" ItemStyle-Width="20px" ItemStyle-Wrap=False
DataField="Concern_DMfgDate" HeaderText="Mfg. Date"
SortExpression="Concern_DMfgDate" />
I'm using a view in Sql Server to get the data, maybe I can do it in there?
why does it show only the date (i.e. 1/12/2001) in Sql Server but in grid
date and time show?
1/12/2001 12:00:00 AM

Thanx.
 
I

IPGrunt

Is there a way to truncate the Sql Server datetime field when displaying in a
datagrid? I get the date and time, I only want date displayed.
It's a bound column:
<asp:BoundColumn HeaderStyle-CssClass="gridtext" HeaderStyle-Wrap=False
ItemStyle-CssClass="gridtext" ItemStyle-Width="20px" ItemStyle-Wrap=False
DataField="Concern_DMfgDate" HeaderText="Mfg. Date"
SortExpression="Concern_DMfgDate" />
I'm using a view in Sql Server to get the data, maybe I can do it in there?
why does it show only the date (i.e. 1/12/2001) in Sql Server but in grid
date and time show?
1/12/2001 12:00:00 AM

Thanx.


Have you tried something like:

DataFormatString="{0:d}"

as a property to your Bound column?

-- ipgrunt
 

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

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top