<!-- 以下为必读项,不仔细阅读会导致你的 Issue 被关闭 1. 该分类下只能提交 Bug,如果要询问使用方法等,请前往讨论区:https://github.com/dotnetcore/FreeSql/discussions 2. FreeSql写了许多文档,在提问题前,麻烦先查看[常见问题](http://freesql.net/reference/faq.html) 3. 不完整的信息将不会得到任何回复!发布问题后,请保持对 issue 的关注,有时会有需要进一步沟通的信息,很长时间内没有得到答复的 issue 将被关闭。 4. 提供可重现的代码,至少应描述以下信息 --> #### 问题描述及重现步骤: 使用DateTime.Year进行查询,代码类似 ```where.And(x => x.PublishTime.Year == 2021);``` 在Sqlite数据库中,`x.PublishTime.Year == 2021`会转换成`strftime('%Y',a."PublishTime") = 2021`,前面为char类型,后面是int类型,无法查询到正确的数据。 如果使用 ```where.And(x => x.PublishTime.Year.ToString() == "2021");``` 会转换为`cast(strftime('%Y',a."PublishTime") as character) = '2021'`,也无法查询到正确数据。 应该转换为`strftime('%Y',a."PublishTime") = '2021'`,即前后都为char,在c#中表示应该类似为 ```where.And(x => x.PublishTime.Year == "2021");``` 但是由于数据类型不一致,无法编译通过。 #### 数据库的具体版本 Sqlite #### 安装的包 FreeSql.All 2.5.100 #### .net framework/. net core? 及具体版本 .Net5
Activity
luoyunchong commentedon Jun 18, 2021
where.And(x => x.PublishTime.Year.ToString() == "2021");测试 没问题。luoyunchong commentedon Jun 19, 2021
sqlite
strftime('%m',a."CreateTime")查出来的数据 是06 而不是 6 。Millisecond 没有*1000,得到0
Ticks 精度有些问题。
所以这个时间处理上还是有问题。
[-]DateTime查询问题[/-][+]Sqlite where.And(x => x.PublishTime.Year == 2021); 查询问题 [/+]#804 fix sqlite where datetime year,month 查不出来数据,Ticks 精度到毫秒,处理Millis…
v2.6.100 #843 #816 #815 #804 #803 #802