OiO.lk Blog python Aware datetime objects output different UTC offsets in one timezone
python

Aware datetime objects output different UTC offsets in one timezone


My database is storing dates with time in UTC timezone.

I have a python program that uses ORM to query database. This ORM is configured to use Europe/London timezone. When I receive python datetime objects I expect them to be in +01:00 offset, but some dates have +00:00 (UTC) offset as can be seen below

@atomic()
async def test():
    async for user in User.all().order_by("-id").limit(3):
        print(user.datetime)
        print(user.datetime.timetz().tzname())

What should I do about it? How can I fix this?



You need to sign in to view this answers

Exit mobile version