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.now([tz]) has an optional tz argument, but it has to be of type datetime.tzinfo… I have not ben able to figure out how to define a tzinfo object for Eastern timezone… Seems like it should be pretty simple, but I cant figure it out without importing an additional library.
I am not very conversent about the EDT time zone but this example should serve your purpose.
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.
Now you could use this to get the info with time zone correctness:
Output: