I am having the hardest time trying to get the current time in EDT timezone.
print datetime.time(datetime.now()).strftime(\"%H%M%S\")
datetime.
I am not very conversent about the EDT time zone but this example should serve your purpose.
import datetime
datetime.datetime.now must be passed the time zone info which should be of type datetime.tzinfo. Here is a class that implements that with some of the required functions. I am providing no day light saving details here as this is an example.
class EST(datetime.tzinfo):
def utcoffset(self, dt):
return datetime.timedelta(hours=-5)
def dst(self, dt):
return datetime.timedelta(0)
Now you could use this to get the info with time zone correctness:
print datetime.datetime.now(EST())
Output:
2010-11-01 13:44:20.231259-05:00