[Answered ]-Django Queryset datetime filtering

1👍

Perhaps something like this:

from datetime import datetime

now = datetime.today()
Appointment.objects.filter(date__gte=now)

0👍

You can work with the timestamp of the database with a Now expression [Django-doc]:

from django.db.models.functions import Now

Appointment.objects.filter(date__gte=Now())

Leave a comment