Optimized code

This commit is contained in:
sunkaixuan 2023-03-28 16:18:54 +08:00
parent 49c1509d53
commit df8ca842d3

View File

@ -141,6 +141,10 @@ namespace SqlSugar
public static DateTime ObjToDate(this object thisValue)
{
if (thisValue is DateTime)
{
return (DateTime)thisValue;
}
DateTime reval = DateTime.MinValue;
if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
{
@ -151,6 +155,10 @@ namespace SqlSugar
public static DateTime ObjToDate(this object thisValue, DateTime errorValue)
{
if (thisValue is DateTime)
{
return (DateTime)thisValue;
}
DateTime reval = DateTime.MinValue;
if (thisValue != null && thisValue != DBNull.Value && DateTime.TryParse(thisValue.ToString(), out reval))
{