  
      >>> import pytz
      >>> melb = pytz.timezone('Australia/Melbourne')
      >>> experiments_per_month = Experiment.objects.annotate(
      ...    month=TruncMonth('start_time', tzinfo=melb)).values('month').annotate(
      ...    experiments=Count('id'))
      >>> for exp in experiments_per_month:
      ...     print(exp['month'], exp['experiments'])
      ...
      2015-06-01 00:00:00+10:00 1
 
</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     >>> Experiment.objects.create(start_time=start1, start_date=start1.date())
    >>> Experiment.objects.create(start_time=start2, start_date=start2.date())
    >>> Experiment.objects.create(start_time=start3, start_date=start3.date())
 </s> add     >>> Experiment.objects.create(start_datetime=start1, start_date=start1.date())
    >>> Experiment.objects.create(start_datetime=start2, start_date=start2.date())
    >>> Experiment.objects.create(start_datetime=start3, start_date=start3.date()) </s> remove     ...    start_day=Trunc('start_time', 'day', output_field=DateTimeField())
 </s> add     ...    start_day=Trunc('start_datetime', 'day', output_field=DateTimeField()) </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     ...     day=ExtractDay('start_time', tzinfo=melb),
    ...     weekday=ExtractWeekDay('start_time', tzinfo=melb),
    ...     hour=ExtractHour('start_time', tzinfo=melb),
 </s> add     ...     day=ExtractDay('start_datetime', tzinfo=melb),
    ...     weekday=ExtractWeekDay('start_datetime', tzinfo=melb),
    ...     hour=ExtractHour('start_datetime', tzinfo=melb),
    ...    month=TruncMonth('start_datetime', tzinfo=melb)).values('month').annotate(
  
      >>> import pytz
      >>> melb = pytz.timezone('Australia/Melbourne')
      >>> experiments_per_month = Experiment.objects.annotate(
    ...    month=TruncMonth('start_datetime', tzinfo=melb)).values('month').annotate(
      ...    experiments=Count('id'))
      >>> for exp in experiments_per_month:
      ...     print(exp['month'], exp['experiments'])
      ...
      2015-06-01 00:00:00+10:00 1
keep keep keep keep replace keep keep keep keep keep
 Refs #25774 -- Adjusted datetime database function docs field names. 
docs/ref/models/database-functions.txt