minglelinch
asked on
How to take date substring and get rid of timestamp at t-sql level
I have a datetime type field defined in DB. I select data in a store procedure and bind the selection in a grid. I don't want the timestamp displaying. For "2011-05-19 14:11:16.000", I only want to display "2011-05-19" or "05/19/2011" I tried Convert, substring, or define control width, none of them works. Please help.
The frid is defined as
<asp:GridView ID="kGridView" runat="server"
AllowSorting="True" AutoGenerateColumns="false "
OnDataBound="kGridView_Dat aBound"
OnSelectedIndexChanged="kG ridView_In dexChanged ">
<Columns>
<asp:CommandField HeaderText="Read" ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID #" />
<asp:BoundField DataField="Location" HeaderText="Location" />
... ...
<asp:BoundField DataField="DateOut" HeaderText="DateOut" />
<asp:BoundField DataField="DateIn" HeaderText="DateIn" />
</Columns>
<PagerStyle HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="#F0F0F0" />
</asp:GridView>
The frid is defined as
<asp:GridView ID="kGridView" runat="server"
AllowSorting="True" AutoGenerateColumns="false
OnDataBound="kGridView_Dat
OnSelectedIndexChanged="kG
<Columns>
<asp:CommandField HeaderText="Read" ShowSelectButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID #" />
<asp:BoundField DataField="Location" HeaderText="Location" />
... ...
<asp:BoundField DataField="DateOut" HeaderText="DateOut" />
<asp:BoundField DataField="DateIn" HeaderText="DateIn" />
</Columns>
<PagerStyle HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="#F0F0F0" />
</asp:GridView>
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Work nicely.
ASKER