Update sqlite date expression

This commit is contained in:
sunkaixuna
2021-12-15 21:21:43 +08:00
parent cfd87478cd
commit 131108e282

View File

@@ -878,11 +878,15 @@ namespace SqlSugar
public string GeDateFormat(string formatString, string value) public string GeDateFormat(string formatString, string value)
{ {
if (IsOracle()||IsPg()) if (IsOracle() || IsPg())
{ {
return $"to_char({value},'{formatString}') "; 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')"; return $"DATE_FORMAT({value}, '%Y-%m-%d')";
} }