I have the following model in Django 1.11.10: class Test(models.Model): ... date_start = models.DateTimeField() ...
The following works fine: Test.objects.annotate(day_start=TruncDate(ExpressionWrapper(F('date_start') - timedelta(hours=5), output_field=models.DateField())) If I replace TruncDate with TruncDay or TruncMonth: Test.objects.annotate(day_start=TruncDay(ExpressionWrapper(F('date_start') - timedelta(hours=5), output_field=models.DateField())) I get the following error: ProgrammingError: syntax error at or near "%" LINE 1: ...TE_TRUNC('day', ("test_test"."date_start" - %s)) AS "d... Is anyone able to reproduce the problem? The goal is to shift the `date_start` field in time before applying the `Trunc*` operation. Is that possible? Thanks! Andrea Andrea Angelini *Zap 15* Tailored web solutions www.zap15.com -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAAPQ7Y0mAPQU5NATzzR%2BeX8jy-VBKBSjvBRdmcvYLMSYw%2BBnpg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.