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"); }
转载于:https://www.cnblogs.com/GreenGrass/archive/2013/01/10/2854190.html