You can use Extract class
for extracting various components from date as number
from django.db.models.functions import Extract
Following are the lookup names to extract different components.
Given the datetime 2015-06-15 23:30:01.000321+00:00
, the built-in lookup_names return:
Read it in more detail on Django official website: https://docs.djangoproject.com/en/3.2/ref/models/database-functions/
I write simple articles that may help Django developers build web apps