How to get list of all record on basis of year and month

13 views
Skip to first unread message

an...@myfitfuel.in

unread,
Feb 18, 2017, 9:27:17 AM2/18/17
to Django users
Hello,

I am new in django. I would like to display the list of all record of particular month and year.Please find below model structure of my table.

class Order_Detail(models.Model):
        Order_Date_Time=models.DateTimeField(default=datetime.datetime.now(),blank=True,null=True)

and 
for example i would like to query record of month: january and year : 2016
Query am trying is:
  month_wise=Order_Detail.objects.filter(Order_Date_Time__year=2016,Order_Date_Time__month=1)

am getting empty list.


Reply all
Reply to author
Forward
0 new messages