dateutil timezone question
Larry Martell
larry.martell at gmail.com
Fri Dec 23 11:30:25 EST 2016
I have a datetime that looks like this: '2016-11-11T18:10:09-05:00'
and when I pass it to dateutil.parser.parse I get back this:
datetime.datetime(2016, 11, 11, 18, 10, 9, tzinfo=tzoffset(None, -18000))
And I have other datetimes like this: '2016-04-27T00:00:00', which
went passed to dateutil.parser.parse of course does not return a
datetime with the tzinfo.
I need to compare these datetimes, and if I do that I get the dreaded
"can't compare offset-naive and offset-aware datetimes" error.
Is there a way I can get it back without the tzinfo, but instead with
the offset applied to the date, so I can compare these 2?
In other words I want it to return
datetime.datetime(2016, 11, 11, 13, 10, 9)
More information about the Python-list
mailing list