You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your Django app had DateTimeFields before setting USE_TZ=True you will need to manually migrate DATETIME2 columns to DATETIMEOFFSET and convert local time to UTC.
Since this driver uses DATETIME2 as the underlying column type for DateTimeField when USE_TZ=False you wouldn't be able to take advantage of timezones without migrating. One way of doing this is to run
ALTERTABLE TABLENAME
ALTER COLUMN DATETIMEFIELD DATETIMEOFFSET;
UPDATE TABLENAME
SET DATETIMEFIELD = TODATETIMEOFFSET(DATETIMEFIELD, XXX) AT TIME ZONE 'UTC'
replacing TABLENAME with the table name of the table that has the DATETIME2 column to migrate, replacing DATETIMEFIELD with the column name of the DATETIME2 field and the XXX with an integer of the time zone offset in minutes or a string of hours and minutes in the format {+|-}TZH:THM. The range is +14 to -14 (in hours). This script would need to be run on all DateTimeField so that all DATETIME2 columns are converted into DATETIMEOFFSET.