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. General Programming
  3. C#
  4. I want to show Time Field of a MS Access table into a datagridview

I want to show Time Field of a MS Access table into a datagridview

Scheduled Pinned Locked Moved C#
databasehelptutorial
4 Posts 2 Posters 0 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.
  • S Offline
    S Offline
    Sourie
    wrote on last edited by
    #1

    I have a field in a table in a database (MS Access). I have defined datatype : Date/Time with format: Short Time. But when I view my table in a gatagridview, I see for example 12/09/2005 12:35 AM help me please

    Sourie

    H 1 Reply Last reply
    0
    • S Sourie

      I have a field in a table in a database (MS Access). I have defined datatype : Date/Time with format: Short Time. But when I view my table in a gatagridview, I see for example 12/09/2005 12:35 AM help me please

      Sourie

      H Offline
      H Offline
      HemJoshi
      wrote on last edited by
      #2

      Hi Sourie, u can use the following.. dataGridView1[e.ColumnIndex, e.RowIndex].CellStyle.Format = "HH:mm:ss" Not sure about the synatx but it will be just like the above Cheers Hem

      S 1 Reply Last reply
      0
      • H HemJoshi

        Hi Sourie, u can use the following.. dataGridView1[e.ColumnIndex, e.RowIndex].CellStyle.Format = "HH:mm:ss" Not sure about the synatx but it will be just like the above Cheers Hem

        S Offline
        S Offline
        Sourie
        wrote on last edited by
        #3

        Hi Hem, I used this syntax: DataGridView1.Columns[6].DefaultCellStyle.Format = "hh:mm:ss"; but its output is the same for both "08:35:00 AM" and "08:35:00 PM" what is your suggestion?

        Sourie

        S 1 Reply Last reply
        0
        • S Sourie

          Hi Hem, I used this syntax: DataGridView1.Columns[6].DefaultCellStyle.Format = "hh:mm:ss"; but its output is the same for both "08:35:00 AM" and "08:35:00 PM" what is your suggestion?

          Sourie

          S Offline
          S Offline
          Sourie
          wrote on last edited by
          #4

          Finally I found it: DataGridView1.Columns[6].DefaultCellStyle.Format = "hh:mm:ss tt"; Thanks alot

          Sourie

          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