例如2001-2-11 0:00:00 我想得到2001-2-11
我是用如下方法得到的日期值
public static DateTime ValidateDataRow_T(DataRow row, string colname)
{
if (row[colname] != DBNull.Value)
return Convert.ToDateTime(row[colname]);
else
return System.DateTime.MinValue;
}
我是用如下方法得到的日期值
public static DateTime ValidateDataRow_T(DataRow row, string colname)
{
if (row[colname] != DBNull.Value)
return Convert.ToDateTime(row[colname]);
else
return System.DateTime.MinValue;
}
你可以用DateTime?类型
然后
else
return null;
想得到2001-2-11应该是string吧,不然2001-2-11和2001-2-11 0:00:00是一样的
你们都快
用ToString(“”)可以自定义格式