db.models.functions.datetime.TruncMinute

class TruncMinute(expression, output_field=None, tzinfo=None, **extra) [source] kind = 'minute'

db.models.functions.datetime.Trunc

class Trunc(expression, kind, output_field=None, tzinfo=None, **extra) [source] Truncates a date up to a significant component. When you only care if something happened in a particular year, hour, or day, but not the exact second, then Trunc (and its subclasses) can be useful to filter or aggregate your data. For example, you can use Trunc to calculate the number of sales per day. Trunc takes a single expression, representing a DateField or DateTimeField, a kind representing a date part, and

db.models.functions.datetime.TruncDate

class TruncDate(expression, **extra) [source] lookup_name = 'date' output_field = DateField() TruncDate casts expression to a date rather than using the built-in SQL truncate function. It’s also registered as a transform on DateTimeField as __date.

db.models.functions.datetime.ExtractMinute

class ExtractMinute(expression, tzinfo=None, **extra) [source] lookup_name = 'minute'

db.models.functions.datetime.ExtractMonth

class ExtractMonth(expression, tzinfo=None, **extra) [source] lookup_name = 'month'

db.models.functions.datetime.ExtractSecond

class ExtractSecond(expression, tzinfo=None, **extra) [source] lookup_name = 'second' These are logically equivalent to Extract('datetime_field', lookup_name). Each class is also a Transform registered on DateTimeField as __(lookup_name), e.g. __minute. DateTimeField examples: >>> from datetime import datetime >>> from django.utils import timezone >>> from django.db.models.functions import ( ... ExtractYear, ExtractMonth, ExtractDay, ExtractWeekDay, ...

db.models.functions.datetime.ExtractHour

class ExtractHour(expression, tzinfo=None, **extra) [source] lookup_name = 'hour'

db.models.functions.datetime.ExtractYear

class ExtractYear(expression, tzinfo=None, **extra) [source] lookup_name = 'year'

db.models.functions.datetime.ExtractWeekDay

class ExtractWeekDay(expression, tzinfo=None, **extra) [source] lookup_name = 'week_day' These are logically equivalent to Extract('date_field', lookup_name). Each class is also a Transform registered on DateField and DateTimeField as __(lookup_name), e.g. __year. Since DateFields don’t have a time component, only Extract subclasses that deal with date-parts can be used with DateField: >>> from datetime import datetime >>> from django.utils import timezone >>>

db.models.functions.datetime.ExtractDay

class ExtractDay(expression, tzinfo=None, **extra) [source] lookup_name = 'day'