Link to home
Start Free TrialLog in
Avatar of minglelinch
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_DataBound"            
     OnSelectedIndexChanged="kGridView_IndexChanged">
            <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
Avatar of brutaldev
brutaldev
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of minglelinch
minglelinch

ASKER

Thanks a lot. It resolved my problem. Strange I tried but not successful. However it's working now.
Work nicely.