Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django. Get only current day. Only day without time

I want to get current day for now. Only day. For example today is 20-March i need use it in my queryset

query = self.filter(Q(busyrooms__end_date__day=datetime.now().date()),
                    Q(reservedrooms__end_date__day=datetime.now().date()))

Tried to use datetime.now().date() but i got error

TypeError: int() argument must be a string, a bytes-like object or a number, not 'datetime.date'

like image 413
Johnny Avatar asked Sep 15 '25 09:09

Johnny


1 Answers

You can get the current day from datetime_obj by accessing the day attribute of datetimeobj like datetime.now().day

like image 75
Avinash Raj Avatar answered Sep 17 '25 23:09

Avinash Raj