Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. dateTime column in datagrid

dateTime column in datagrid

Scheduled Pinned Locked Moved Database
questiondatabase
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Miri Ofir
    wrote on last edited by
    #1

    I have a table in sqlServer with some columns if dateTime values (date + time) I wrote a stored procedure that select those columns, the stored Procedure works properly. I tried to retrieve the data into dataSet and then to dataGrid. I get a very nice datagrid with the whole data, but the coulumns of datatime values show only the date. I need the time also. How can I get it? I know that there is some types of datacolumn like dataGridBoolColumn or dataGridTextBox column, but I couldn't find dataGridDateTimeColumn. Thank you;)

    A 1 Reply Last reply
    0
    • M Miri Ofir

      I have a table in sqlServer with some columns if dateTime values (date + time) I wrote a stored procedure that select those columns, the stored Procedure works properly. I tried to retrieve the data into dataSet and then to dataGrid. I get a very nice datagrid with the whole data, but the coulumns of datatime values show only the date. I need the time also. How can I get it? I know that there is some types of datacolumn like dataGridBoolColumn or dataGridTextBox column, but I couldn't find dataGridDateTimeColumn. Thank you;)

      A Offline
      A Offline
      afronaut
      wrote on last edited by
      #2

      Use the DataFormattingExpression property. When you get your grid's properties, select your column and you should see an option. For example, you can use expressions like {0:d}, {0:f}, and so on. A full list can be found: http://www.stevex.org/dottext/articles/158.aspx[^] *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";

      M 1 Reply Last reply
      0
      • A afronaut

        Use the DataFormattingExpression property. When you get your grid's properties, select your column and you should see an option. For example, you can use expressions like {0:d}, {0:f}, and so on. A full list can be found: http://www.stevex.org/dottext/articles/158.aspx[^] *->>Always working on my game, teach me *->>something new. cout << "dav1d\n";

        M Offline
        M Offline
        Miri Ofir
        wrote on last edited by
        #3

        Thank you, but I have a window application and the DataFormattingExpression property isn't exist. finally I found a tutorial here, at: http://www.thecodeproject.com/csharp/Apply_DataGridTableStyle.asp[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups