Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我在这个项目中使用 peewee orm ,
我想将 sqlite 数据库中的日期与当前日期进行比较:
class game(BaseModel): stuff= CharField() stuff2= CharField() created_at = DateField() s=game.select().where(game.created_at==datetime.now().date())
但我无法让它工作,我只是得到 None 结果。
最简单的方法是查询一系列日期:
game.select().where(game.created_at.between( datetime.date.today(), datetime.date.today() + datetime.timedelta(days=1))
可以使用 peewee 的 SQL 函数支持:
from peewee import fn game.select().where(game.created_at == fn.now())