Results 1 to 4 of 4

Thread: Displaying Date in DataGrid

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2002
    Location
    Madras
    Posts
    50

    Question Displaying Date in DataGrid

    Hi All,

    i'm displaying a date field along with other fields in datagrid. while i tried, i'm able to get all the values from the table, also the date field. but it is displaying along with the time

    Ex : for "2/25/2005" i'm getting "2/25/2005 12:00:00 AM"

    i use dataadapter to fill the datagrid.

    can any one help me

    thanx

    venkat
    venkat

    Strength is Life, Weakness is Death

    - Swami Vivekananda

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: Displaying Date in DataGrid

    hi,

    In the design mode go to the Datagrid - Property builder, go to the columns section and select the Data Field which you have, there on the lower side you can see the "data Formating expression" box.

    Enter the Format you want the Datagrid to display

    For example:

    {0:d} will display Date in Short date format

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2002
    Location
    Madras
    Posts
    50

    Re: Displaying Date in DataGrid

    Thanks John,

    Its working fine... Is there any way to display like 09-Apr-2005...

    venkat
    venkat

    Strength is Life, Weakness is Death

    - Swami Vivekananda

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Re: Displaying Date in DataGrid

    Change the format string to:

    {0:dd-MMM-yy}

Posting Permissions

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



Click Here to Expand Forum to Full Width