2010-02-06 10:57
而我希望秀出的是:
2007-02-06
如沒特別處理的話,DATAGRIDVIEW會秀出: 2007-2-6 10:57
可以通過dataGridView的CellFormatting事件:
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 3)//設第三列為秀出日期的列
{
e.Value = Convert.ToDateTime(e.Value).ToShortDateString();
}
}
{
if (e.ColumnIndex == 3)//設第三列為秀出日期的列
{
e.Value = Convert.ToDateTime(e.Value).ToShortDateString();
}
}
select dbId,dbContent,dbIsOver,Convert(char(10),資料欄位,23) from mydaily
文章引用自:搜索吧 程序人生