troubleshooting Question

How to take date substring and get rid of timestamp at t-sql level

Avatar of minglelinch
minglelinch asked on
C#.NET ProgrammingASP.NET
3 Comments1 Solution304 ViewsLast Modified:
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
brutaldev

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros