so i'm using peewee orm for this project ,
i want to compare a date from sqlite database with curent date :
class game(BaseModel):
stuff= CharField()
stuff2= CharField()
created_at = DateField()
s=game.select().where(game.created_at==datetime.now().date())
but i can't get it to work , and i'm just getting None as result.
The easiest way is query a range of dates:
game.select().where(game.created_at.between(
datetime.date.today(),
datetime.date.today() + datetime.timedelta(days=1))
You can use peewee's SQL function support:
from peewee import fn
game.select().where(game.created_at == fn.now())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With