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

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

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

    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 Guest

  2. Similar Questions and Discussions

    1. Show Date only from DateTime in DataGrid
      Hi, I am using the following code to display a datagrid on my page. Now one of the columns is of type DateTime(DataField="myDate"). Now when the...
    2. Get the datafield of a column in datagrid
      How can I programmatically retrieve the name of the datafield of a datagrid column, while in the Datagrid1_UpdateCommand event.
    3. Formatting datagrid column to show boolean as Yes/no instead of truefalse
      Is there a way to change the formatting expression of a column in the property builder of the datagrid to make boolean values appear as yes/no...
    4. Separated date and time or one datetime field
      Hi all, I am learning php+mysql and am trying to set up a log database. I wonder if it is better to have 2 different columns for date and time...
    5. get week from date/datetime field
      Hi, I have a very basic quesetion but I can't find any answer by myself. Is it possible to extract number of week from date/datetime column?...
  3. #2

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

    Set your formatting expression to be {0:d}
    "Adil Bohoudi" <adil_dev@hotmail.com> wrote in message
    news:R86Ya.34454$FN3.2595642@news.ono.com...
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139