How To Display Time in hh:mm tt using DataGridView

  • Thread starter Thread starter Steven8579
  • Start date Start date
S

Steven8579

Guest
Good afternoon,

I'm trying to get the time formatted in hh:mm tt format. For example 02:30 PM. I have a database called SubJobs, a datagridvew called datagridvew1 and a column in SubJobs called Time which is a Time(7) datatype.

This is the query I tried:

string query2 = "select chName, MassType, Date, Time, Stipend from SubList where chID= '" + Person.churchID.ToString() + "'; ";


This is the code I tried to format the column in DataGridView:

dataGridView1.Columns[3].DefaultCellStyle.Format = "hh:mm tt";

When I execute the code I get the following message:

1452936.png





Any help would be greatly appreciated!


Thanks,

Steven

Continue reading...
 
Back
Top