Django ORM filter on datetime understands entries with a 'Z' offset, but not '+0000' offset

I have a MySQL database that mirrors a salesforce database. My table has a column for "createddate" that is contains ISO-8601 datetime entries. Some of the entries have an offset of "Z" and some of the entries have an offset of "+0000" like this:

2025-01-20T17:18:18.000Z

2025-01-20T18:11:10.000Z

2025-01-20T17:27:55.000+0000

2025-01-20T17:29:46.000Z

2025-01-20T17:28:19.000+0000

When I attempt to filter on a certain date, the filter ONLY returns lines that have a "Z" offset. lines with "+0000" are not returned.

My filter code looks like:

receipts = Receipt.objects.filter(createddate__date='2025-01-20').count()

As far as I can tell, both formats conform to ISO-8601.

I do have USE_TZ set to true in my settings.py

the field is configured in models.py like:

createddate = models.CharField(db_column='CreatedDate', max_length=28, blank=True, null=True)

Relatively new to django and its ORM, I'm currently working around with a raw SQL query but I'd rather do it natively if possible.

Вернуться на верх