62,268
社区成员
发帖
与我相关
我的任务
分享
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = Convert.ToDateTime(e.Row.Cells[0].Text).ToShortDateString();
}
<asp:BoundField DataField="日期字段" DataFormatString="{0:yyyy-MM-dd}"
Select CONVERT(varchar(100), GETDATE(), 23)--2012-06-08
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[日期列索引].Text = 格式化字符串;
}
}