PythonAnywhere Forums

Timezones flipping back and forth?

I noticed that my timezones keep changing for eastern time to easterntime + 4 hours. (When I do I get either Eastern time or eastern time + 4 hours) I have been adding time_delta(hours = -4) in order to fix for this. Why's this happening?

What version of python are you using?

If 3.3+, have you looked at something like:


Saw an interesting discussion at , for example.



Hmm, it would be strange if timezones are changing. Our servers are all set up to use UTC (which I think is currently 4 hours off eastern time). So and datetime.utcnow() should return the same value.

Do you have a timezone setting somewhere in your code? For example, if you have a Django site with the timezone set, you might get eastern time for code running in a Django context, and UTC for code running outside that context.