Serious Problem with Timezone

T-u-N-i-X alperkanat at gmail.com
Mon May 19 18:02:21 EDT 2008


Hey There,

I'm a django developer and working on a project right now.. Last week
I just discovered a new problem in Python.. Here's what I do..

[01:00] (tunix at penguix ~)$ date
Sal May 20 01:00:10 EEST 2008
[01:00] (tunix at penguix ~)$ python
Python 2.5.2 (r252:60911, Feb 23 2008, 21:20:32)
[GCC 4.2.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.now()
datetime.datetime(2008, 5, 20, 1, 0, 21, 131804)
>>> import os
>>> os.environ["TZ"] = "Europe/Istanbul"
>>> datetime.now()
datetime.datetime(2008, 5, 19, 22, 0, 38, 578438)
>>>

It's 01:00 in Istanbul now and Python shows 22:00 on 19th of May if I
set the TZ environment variable.. Django sets that variable
automatically so I'm having problems with scheduled posts..

I controlled my system's BIOS time.. It was wrong before, so I just
corrected it.. I set the time to UTC on Linux.. What else can I do ?



More information about the Python-list mailing list