Results 1 to 5 of 5

Thread: format date column in datatable

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    83

    format date column in datatable

    hi,

    how can I format a date/time column held in a DataTable. I want to display only the time part of it.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,296

    Re: format date column in datatable

    You don't. A DataTable should store DateTime values and they have no format. Format is only an issue when converting a DateTime value to a String, which 99 times out of 100 would be done in order to display it. If that is what you want to do then how you format the string depends on how it's being displayed.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    83

    Re: format date column in datatable

    well actually I could not find a way to format the date/time column of my database table in the datagrid in my compact framework app. so I thought might as well try to format it in the datatable itself before binding it to the data grid. ya i understand its not right.

    well i guess i'll have find an alternative.

    any ideas???
    Last edited by sunshine123; Jun 18th, 2007 at 04:13 AM.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,296

    Re: format date column in datatable

    I'm not sure how much the CF supports but column formatting in a DataGrid is usually handled by the DataGridColumnStyle class. Check out this page for heaps of DataGrid information.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2007
    Posts
    83

    Re: format date column in datatable

    OK thanks.....

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