Gridview

Last post 02-03-2008 12:11 PM by johandanielsson. 3 replies.

Sort Posts:

  • Gridview

    02-03-2008, 10:47 AM

    How to make a datetime coloum in a gridview only show the date not the time? The database is made in access.

  • Re: Gridview

    02-03-2008, 10:58 AM
    Answer
    • All-Star
      97,048 point All-Star
    • mbanavige
    • Member since 11-06-2003, 1:29 PM
    • New England, USA
    • Posts 10,261
    • Moderator
      TrustedFriends-MVPs

    like this:

    <asp:GridView ID="GridView1" runat="server">

        <Columns>

            <asp:BoundField DataField="yourDateField" DataFormatString="{0:d}" HtmlEncode="False" />

        </Columns>

    </asp:GridView>

    Mike Banavige
    ~~~~~~~~~~~~
    Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/
  • Re: Gridview

    02-03-2008, 11:12 AM
    Answer
    • Contributor
      3,351 point Contributor
    • XGmarX
    • Member since 02-12-2007, 10:30 AM
    • Posts 603

     

    Hello,  
    You can use one of these ...  

    in your statement write the date like the following:

    select to_char(HIRE_DATE, 'dy/mon/rrrr')
                                        from employees

    or just like mbanavige said:

    <asp:GridView ID="GridView1" runat="server">

        <Columns>

            <asp:BoundField DataField="yourDateField" DataFormatString="{0:d}" HtmlEncode="False" />

        </Columns>

    </asp:GridView>

     

     

    Please, let me know if that helped ...

    Please, “Mark as Answer” the post that helped you.
  • Re: Gridview

    02-03-2008, 12:11 PM

    It worked without problem. Thanks

Page 1 of 1 (4 items)