  
      >>> import pytz
      >>> tzinfo = pytz.timezone('Australia/Melbourne')
      >>> Experiment.objects.annotate(
      ...     day=ExtractDay('start_time', tzinfo=melb),
      ...     weekday=ExtractWeekDay('start_time', tzinfo=melb),
      ...     hour=ExtractHour('start_time', tzinfo=melb),
      ... ).values('day', 'weekday', 'hour').get(
      ...     end_time__year=ExtractYear('start_time'),
      ... )
      {'day': 16, 'weekday': 3, 'hour': 9}
  
 
</s> remove     ...     end_time__year=ExtractYear('start_time'),
 </s> add     ...     end_datetime__year=ExtractYear('start_datetime'), </s> remove     ...        day=ExtractDay('start_time'),
    ...        weekday=ExtractWeekDay('start_time'),
    ...        hour=ExtractHour('start_time'),
 </s> add     ...        day=ExtractDay('start_datetime'),
    ...        weekday=ExtractWeekDay('start_datetime'),
    ...        hour=ExtractHour('start_datetime'), </s> remove     >>> Experiment.objects.create(start_time=start1, start_date=start1.date())
 </s> add     >>> Experiment.objects.create(start_datetime=start1, start_date=start1.date()) </s> remove     ...        end_time__year=ExtractYear('start_time'),
 </s> add     ...        end_datetime__year=ExtractYear('start_datetime'), </s> remove     ...     date=TruncDate('start_time'),
    ...     day=TruncDay('start_time', tzinfo=melb),
    ...     hour=TruncHour('start_time', tzinfo=melb),
    ...     minute=TruncMinute('start_time'),
    ...     second=TruncSecond('start_time'),
 </s> add     ...     date=TruncDate('start_datetime'),
    ...     day=TruncDay('start_datetime', tzinfo=melb),
    ...     hour=TruncHour('start_datetime', tzinfo=melb),
    ...     minute=TruncMinute('start_datetime'),
    ...     second=TruncSecond('start_datetime'),
    ...     day=ExtractDay('start_datetime', tzinfo=melb),
    ...     weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
    ...     hour=ExtractHour('start_datetime', tzinfo=melb),
  
      >>> import pytz
      >>> tzinfo = pytz.timezone('Australia/Melbourne')
      >>> Experiment.objects.annotate(
    ...     day=ExtractDay('start_datetime', tzinfo=melb),
    ...     weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
    ...     hour=ExtractHour('start_datetime', tzinfo=melb),
    ...     day=ExtractDay('start_datetime', tzinfo=melb),
    ...     weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
    ...     hour=ExtractHour('start_datetime', tzinfo=melb),
    ...     day=ExtractDay('start_datetime', tzinfo=melb),
    ...     weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
    ...     hour=ExtractHour('start_datetime', tzinfo=melb),
      ... ).values('day', 'weekday', 'hour').get(
      ...     end_time__year=ExtractYear('start_time'),
      ... )
      {'day': 16, 'weekday': 3, 'hour': 9}
  
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #25774 -- Adjusted datetime database function docs field names. 
docs/ref/models/database-functions.txt