python - Can't subtract offset-naive and offset-aware datetimes -
I have a timezone aware timestamp field in PostgreSQL. When I pull data from the table, then I want to reduce the time so that I can get her age.
The problem I am having is that both datetime.datetime.now () and datetime.datetime.utcnow () timen unrecognized timestamp I get this error as a result:
TypeError: can not subtract offset-meaningful and offset-aware dataset There is a way to avoid this (preferably without the use of a third-party module).
EDIT: Suggestions, although trying to adjust the time zone seems to give me errors .. so I'm just going to use the timetable in the timezap in the timepiece and always use it:
At () AT time zone 'UTC' In this way all my timestamps are UTC by default (even if it is more troubling in doing this Is happening).
have you tried to remove timezone awareness?
naive = dt.replace (tzinfo = none) may also need to add a time zone conversion.
Comments
Post a Comment