Browse Source

Update sqlite date expression

pull/10/MERGE
sunkaixuna 3 years ago
parent
commit
131108e282
  1. 8
      Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

8
Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs

@ -878,11 +878,15 @@ namespace SqlSugar
public string GeDateFormat(string formatString, string value)
{
if (IsOracle()||IsPg())
if (IsOracle() || IsPg())
{
return $"to_char({value},'{formatString}') ";
}
else if (IsMySql()&& formatString == "yyyy-MM-dd")
else if (IsSqlite() && formatString == "yyyy-MM-dd")
{
return $"strftime('%Y-%m-%d', {value})";
}
else if (IsMySql() && formatString == "yyyy-MM-dd")
{
return $"DATE_FORMAT({value}, '%Y-%m-%d')";
}

Loading…
Cancel
Save