Hi, I am having a problem related to Tz Conversion. I found that using pytz.timezone() with astimezone() method generates invalid timezone conversion adding some extra minutes to the final value.
Here is the example to replicate the problem:
import datetime
import pytz
from dateutil import tz
dt_sao_paulo = datetime.datetime(2024, 1, 1, 10, 10, tzinfo=pytz.timezone('America/Sao_Paulo'))
dt_utc = dt_sao_paulo.astimezone(pytz.utc)
print(dt_utc)
# same conversion with different lib
dt_sao_paulo = datetime.datetime(2024, 1, 1, 10, 10, tzinfo=tz.gettz('America/Sao_Paulo'))
dt_utc = dt_sao_paulo.astimezone(tz.UTC)
print(dt_utc)
The result printed:
2024-01-01 13:16:00+00:00
2024-01-01 13:10:00+00:00
The first one added 6 minutes to the final datetime.
Hi, I am having a problem related to Tz Conversion. I found that using
pytz.timezone()withastimezone()method generates invalid timezone conversion adding some extra minutes to the final value.Here is the example to replicate the problem:
The result printed:
The first one added 6 minutes to the final datetime.