Forums

Import Time uses GMT not EST

The time recorded through:

currentDate, currentTime = time.strftime("%m/%d/%Y"), time.strftime("%H:%M:%S")

gives GMT time, not local/EST time. I've followed the instructions here, but it didn't fix anything. Any thoughts?

Can I take a look at your files? We can see them from our side, but we always ask permission first.

Yes, go ahead.

I don't see anything like

export TZ="US/Eastern"

in your .bashrc file. What did you change based on the other forum thread?

Could you check again: I added it, but still doesn't seem to work.

How are you running your Python process?

I am running it on a Python 2.7 console.

Interesting. I would have thought that would pick up the stuff from .profile, but I see it doesn't.

Perhaps you could put this code at the top of your Python file:

import os
import time

os.environ["TZ"] = "US/Eastern"
time.tzset()

Yes! That worked, thank you! :)