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>

 
C#.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
minglelinch

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
brutaldev

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
minglelinch

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

ASKER
Work nicely.
Your help has saved me hundreds of hours of internet surfing.
fblack61