[Answer]-Get pub_date value using filters

1👍

If you want to filter by certain date, either

import datetime
the_day = datetime.date(2013, 1, 30)
Ventas.objects.filter(Fecha_registro__gte=the_day, 
                      Fecha_registro__lt=the_day+datetime.timedelta(1))

Or

Ventas.objects.extra(where=["DATE(Fecha_registro)=%s"], params=['2013-01-30'])

Or inefficient but workable

Ventas.objects.filter(Fecha_registro__year=2013, 
                      Fecha_registro__month=1,
                      Fecha_registro__day=30)

The doc of gte, lt, extra, year, month and day is here

👤okm

Leave a comment