From 131108e28228e9ae81698922e1b914309245893b Mon Sep 17 00:00:00 2001 From: sunkaixuna <610262374@qq.com> Date: Wed, 15 Dec 2021 21:21:43 +0800 Subject: [PATCH] Update sqlite date expression --- .../ResolveItems/MethodCallExpressionResolve.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs b/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs index ba2ed753b..eefa76353 100644 --- a/Src/Asp.Net/SqlSugar/ExpressionsToSql/ResolveItems/MethodCallExpressionResolve.cs +++ b/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')"; }