﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32513	SQLite3 Backend Falsly claims SQLite does not support Timezone aware DateTimes	Arthur Moore	nobody	"If settings.USE_TZ is False, and I am using an SQLite3 database, I expect to be able to store a timezone aware DateTime Field.

Currently in [https://github.com/django/django/blob/b19041927883123e0147d80b820ddabee9a716f6/django/db/backends/sqlite3/operations.py#L236 the code], this raises a ValueError.


The SQLite [https://sqlite.org/lang_datefunc.html documentation] indicates that this is actually valid. In addition, if a database entry is modified with ""-05:00"" appended, then Django will correctly read from the database.  Though attempting to immediately call save fails.

**Example:**
With a database where the first record has a timestamp with a timezone, and ""settings.USE_TZ=False"":
{{{
class DataPoint(models.Model):
    timestamp = models.DateTimeField()

d = DataPoint.objects.first()
print(d.timestamp)  # Successfully prints a datetime.datetime object with the correct tzinfo
d.save()  # Raises ""ValueError: SQLite backend does not support timezone-aware datetimes when USE_TZ is False.""
}}}

**Why this matters:**
We are storing scientific measurements where the customer needs to know the local day in which the data was recorded.  This does not work by calculating their current timezone, as they care about the information as it was recorded not as it is now.

Our current approach is to leave ""USE_TZ=True"", store the timezone as an offset in minutes every time a data collection session takes place, and then combine them later.  However, this means that we are either working around the ORM when selecting dates, or just not using it entirely.

Ideally, we would leave ""USE_TZ=True"", and only save the DataPoint with a timestamp, but that is a separate feature request."	Bug	new	Database layer (models, ORM)	3.1	Normal		datetime, timezone		Unreviewed	0	0	0	0	1	0
