J
Joshua J. Kugler
I've read docs (datetime, time, pytz, mx.DateTime), googled, and
experimented. I still don't know how to accomplish what I want to
accomplish.
I'm loading up a bunch of date/time data that I then need to do math on to
compare it to the current date/time. I can get the current time easily
enough:
currentTime = datetime.datetime.now(pytz.timezone('America/Anchorage'))
Then, I want to import data/time pairs that are in "%Y-%m-%d %H:%M:%S"
format.
So, I do:
For each loop, extract time data, blah, blah, then:
readingTime = datetime.datetime(rYr, rMo, rDay, rHr, rMin, rSec,
tzinfo=pytz.timezone('America/Anchorage'))
The problem is, how do I create a datetime object and tell it that it's
America/Anchorage *daylight savings time* instead of whatever the system is
currently set at? pytz only has America/Anchorage, and I saw no way to
tell it explicitly that the timezone is in Daylight instead of Standard
time (e.g. using AKST vs. AKDT for the time zone).
I'm sure there is a way to do it, and I'm sure it's quite simple, but it
hasn't jumped out at me yet. Is there a module that I haven't seen that
would be better suited for this?
Thanks!
j
experimented. I still don't know how to accomplish what I want to
accomplish.
I'm loading up a bunch of date/time data that I then need to do math on to
compare it to the current date/time. I can get the current time easily
enough:
currentTime = datetime.datetime.now(pytz.timezone('America/Anchorage'))
Then, I want to import data/time pairs that are in "%Y-%m-%d %H:%M:%S"
format.
So, I do:
For each loop, extract time data, blah, blah, then:
readingTime = datetime.datetime(rYr, rMo, rDay, rHr, rMin, rSec,
tzinfo=pytz.timezone('America/Anchorage'))
The problem is, how do I create a datetime object and tell it that it's
America/Anchorage *daylight savings time* instead of whatever the system is
currently set at? pytz only has America/Anchorage, and I saw no way to
tell it explicitly that the timezone is in Daylight instead of Standard
time (e.g. using AKST vs. AKDT for the time zone).
I'm sure there is a way to do it, and I'm sure it's quite simple, but it
hasn't jumped out at me yet. Is there a module that I haven't seen that
would be better suited for this?
Thanks!
j