How to convert db DateTime field into local time and construct Q object for retrieving the dataset?
settings.py
LANGUAGE_CODE = 'en-us'
USER_TIME_ZONE = 'US/Pacific'
TIME_ZONE = 'UTC'
USE_TZ = True
models.py
class Hello(models.Model):
lucky_day = models.DateTimeField()
One record in db (UTC format)
2019-02-03 03:02:45
filter.py
# Client browser is Pacific time without time, date only.
localtime_str = '2019-3-2'
qset_filter = Q(lucky_day<to Pacific time from UTC>=localtime_str)