I’m confused on datetime comparison with Django datetime field, here is the code
now = datetime.now()
delta = talk.when + timedelta(minutes=(talk.duration + 10))
if now > delta:
return True
return False
talk is just datetime field,
duration is integer field
now – should have hours equal to 17:43 however I’ve 5:43 (datetime.datetime(2012, 5, 14, 5, 43, 24, 228401))
What is the problem, whats wrong in the code?
Now it works
I just added USER_ENV_TZ variable with my local timezone and used utcnow
if os.getenv('ENV_USER_TZ', None):
TIME_ZONE = os.getenv('ENV_USER_TZ') # changed to UTC
Thanks,
Sultan
Now it works
I just added USER_ENV_TZ variable with my local timezone and used
utcnowsuggested by @ BluePeppersThank you all