我有一个对象now
就是current datetime
对象。我想做一个这样的查询:
过滤所有结果MyModel
,WHERE the (now - obj_time).days == 0
其中, obj_time 是一个DateTimeField
in MyModel
。通常,我的目标是做一些事情,让我obj_time
在过去 24 小时内获取所有具有 a 的元组。所以我想做的是使用来自的字段days
来查看它是还是. 如果它不是 0,那么它超过一天。如何才能做到这一点?timedelta
difference of the obj_time and the current time
days field is equal to 0
not