Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Windows 窗体应用程序。我有一个查询,它以 dd-MM-yyyy 格式返回我的日期时间。但是当这个日期时间显示在数据网格中时,它显示为dd/MM/yyyy. 我希望显示dd-MM-yyyy在我的数据网格中。这怎么可能实现。
dd/MM/yyyy
dd-MM-yyyy
您在列的 DefaultCellStyle.Format 中设置它:
this.dataGridView1.Columns["Date"].DefaultCellStyle.Format = "dd-MM-yyyy";