Why doesn't replace modify the tzinfo object when it recieves a valid timezone object?
I'm attempting to add the local time to timestamps that didn't specify a timezone.
if raw_datetime.tzinfo is None:
print(raw_datetime)
print(raw_datetime.tzinfo)
raw_datetime.replace(tzinfo=dateutil.tz.tzlocal())
print(raw_datetime.tzinfo, dateutil.tz.tzutc())
According to the documentation I should be able to change the tzinfo attribute with a valid datetime
https://docs.python.org/2/library/datetime.html#datetime.date.replace
But I'm obviously doing something wrong because the tzinfo object is still
None
.
2000-04-25 12:57:00
None
None tzutc()