date format

Discussion in 'ASP .Net' started by Mike, Jun 7, 2004.

  1. Mike

    Mike Guest

    I have a date in my table format like YYYY/DD/MM 2004/7/7

    but when I pull that value out of the table in .net and populate my grid it
    looks like:

    7/7/2004 12:00:00 AM

    I don't want that, i want to see exactly how it is in my table. How do i
    accomplish that with .NET so it does not change the format
     
    Mike, Jun 7, 2004
    #1
    1. Advertising

  2. Hi Mike,

    You can set the DataFormatString for your grid like this:

    <asp:DataGrid id="DataGrid1" runat="server">
    <Columns>
    <asp:BoundColumn DataField="ADateTime" HeaderText="Date and Time"
    DataFormatString="{0:yyyy/M/d}"></asp:BoundColumn>
    </Columns>
    </asp:DataGrid>

    Does this help?

    Ken
    Microsoft MVP [ASP.NET]
    Toronto

    "Mike" <> wrote in message
    news:...
    >I have a date in my table format like YYYY/DD/MM 2004/7/7
    >
    > but when I pull that value out of the table in .net and populate my grid
    > it
    > looks like:
    >
    > 7/7/2004 12:00:00 AM
    >
    > I don't want that, i want to see exactly how it is in my table. How do i
    > accomplish that with .NET so it does not change the format
    >
    >
     
    Ken Cox [Microsoft MVP], Jun 8, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Candy
    Replies:
    2
    Views:
    1,194
    Janaka
    Feb 18, 2004
  2. DC
    Replies:
    5
    Views:
    3,028
    Brendan Reynolds
    Jul 1, 2005
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,332
    Michael Borgwardt
    May 30, 2004
  4. Chu
    Replies:
    3
    Views:
    4,223
    Shawn
    Aug 15, 2006
  5. Josh Sharpe
    Replies:
    1
    Views:
    221
    Brian Candler
    Sep 21, 2010
Loading...

Share This Page