Python: Extract year from datetime.datetime.today().date()

I registered a date to system with dates that is in this format: DateRegistered = datetime.datetime.today().date() .

So I want to get the number of user that registered this year.

I used this: len(Applicant.objects.filter(DateRegistered=datetime.datetime.today().year))

But it returned 0. Is there other way on how to extract the year?

Back to Top