Hello I am using Pythonanywhere and when I call
from datetime import *
print date.today().day
It is printing a different day than the day it is where I live (Austin, Texas). I figured it is because there is a timezone difference. How would I tell the date object where I live so it gets the right timezone. Thanks in advance
The most robust way to do this is to use
pytz. You can install it simply withpip install pytz.To get the local date with
pytz, you can simply do this (note that thedate.todaymethod will not take a timezone):Compare that to the present Greenwich date: