show just the date in a datagrid column when the datafield is an datetime field

Discussion in 'ASP .Net' started by Adil Bohoudi, Aug 6, 2003.

  1. Adil Bohoudi

    Adil Bohoudi Guest

    Hi all,

    i'm using a datagrid to show somedata retrieved from an sql-server 2000.

    this datagrid contains two columns a startdate and an enddate column.
    i used a storedprocedure to get both dates. but when i use the following
    code:

    datagrid.datasource = selDates()
    datagrid.bind()

    both columns show the retrived datetime value. it's a little bit ugly to
    see.......... the only thing i need is just the date value....

    does someone know how to show only the datepart in a datagrid column

    thanks in advance,

    Adil
    Adil Bohoudi, Aug 6, 2003
    #1
    1. Advertising

  2. Adil Bohoudi

    Eric Wise Guest

    Set your formatting expression to be {0:d}
    "Adil Bohoudi" <> wrote in message
    news:R86Ya.34454$...
    > Hi all,
    >
    > i'm using a datagrid to show somedata retrieved from an sql-server 2000.
    >
    > this datagrid contains two columns a startdate and an enddate column.
    > i used a storedprocedure to get both dates. but when i use the following
    > code:
    >
    > datagrid.datasource = selDates()
    > datagrid.bind()
    >
    > both columns show the retrived datetime value. it's a little bit ugly to
    > see.......... the only thing i need is just the date value....
    >
    > does someone know how to show only the datepart in a datagrid column
    >
    > thanks in advance,
    >
    > Adil
    >
    >
    Eric Wise, Aug 6, 2003
    #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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    704
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    532
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    386
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    333
    Martin
    Dec 27, 2008
  5. et

    Get the datafield of a column in datagrid

    et, Dec 28, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    3
    Views:
    149
    Eliyahu Goldin
    Jan 2, 2005
Loading...

Share This Page