in
Memphis .NET User Group

Truncate time from an SQL Query

Last post 04-03-2008 1:13 PM by soonlim. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-31-2008 5:47 PM

    • jason901
    • Top 25 Contributor
    • Joined on 03-27-2008
    • Memphis
    • Posts 1

    Truncate time from an SQL Query

    I am trying to display a date on a Gridview but I get the date with the time from an SQL query.  How can I truncate the time from the SQL return?  Or simply just display the date?  My program is in C# and I’m using MS VS 2005.

     

    Thanks!

     

    Jason

    Filed under:
  • 04-03-2008 1:13 PM In reply to

    • soonlim
    • Top 10 Contributor
    • Joined on 11-01-2007
    • Memphis
    • Posts 6

    Re: Truncate time from an SQL Query

     You can try to format the date into string with format of yyyyMMdd

     eg     datetime.ToString("yyyyMMdd")   or (yyyy/mm/dd)

         This will return you just date with this format without time or you can change to whatever format you want
     

    Good Luck 

    DotNet Lover
    Filed under:
Page 1 of 1 (2 items)