I do some research about this topic but i cannot find a solution.
`CreatedDate=models.DateTimeField(auto_now_add=True)`
when i create a model using this code, data type of mssql set as datetimeoffset(7).But i wish to create as type of datetime2(7).
I tried django-mssql-backend library.(It set as datetimeoffset(7)).I was expected datetime2.
https://stackoverflow.com/questions/65600327/sql-datetime27-field-to-django I followed the instructions here but the solution did not work for me
Shortly, how can i create datetime2 with using Django model?
1条答案
按热度按时间cwtwac6a1#
The problem was releated with timezone.To solution:
USE_TZ = False
) as false in django settings, model created as datetime2.