Problems when working with different timezones

O

ocgstyles

Here's some Python code executed on Red Hat 3.4 web server located in
Mountain time (MDT). You'll notice that the time after setting the
timezone to Eastern time (EST), the time is incorrectly 6 hours ahead,
when it should only be 3.

Python 2.5 (r25:51908, Mar 23 2007, 14:22:20)
[GCC 3.4.6 20060404 (Red Hat 3.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import datetime, os
datetime.datetime.today() datetime.datetime(2008, 9, 2, 11, 25, 35, 39856)
os.environ['TZ']='America/New_York'
datetime.datetime.today()
datetime.datetime(2008, 9, 2, 17, 26, 0, 703537)

Here's the same thing executed on an Ubuntu box in EST. I alter the
timezone to a MDT and it works as one would expect.

Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import datetime, os
datetime.datetime.today() datetime.datetime(2008, 9, 2, 13, 11, 6, 438123)
os.environ['TZ'] = 'America/Denver'
datetime.datetime.today()
datetime.datetime(2008, 9, 2, 11, 11, 21, 43602)

What could be the reason for this failing on Red Hat?

Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top