更新时间:2023-01-29 08:14:32
如果是Windows窗体DataGrid,可以使用下面的code格式化日期时间为列
If it is a windows form Datagrid, you could use the below code to format the datetime for a column
dataGrid.Columns[2].DefaultCellStyle.Format = "MM/dd/yyyy HH:MM:ss";
编辑:
除此之外,如果你需要的AM / PM格式的日期时间,你可以使用下面的code
Apart from this, if you need the datetime in AM/PM format, you could use the below code
dataGrid.Columns[2].DefaultCellStyle.Format = "MM/dd/yyyy hh:mm:ss tt";