日期格式设置
public static DateTime Str2Date(string value)
{
if (string.IsNullOrEmpty(value))
return DateTime.MinValue;
else
{
DateTimeFormatInfo dtFormat = new DateTimeFormatInfo();
dtFormat.ShortDatePattern = "dd-MM-yy";
return Convert.ToDateTime(value, dtFormat);
}
}
public static string Date2String(DateTime value)
{
if (value == DateTime.MinValue)
return string.Empty;
else
return value.ToString("dd-MM-yy");
}