Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Tz conversion adding extra minutes. #120

Open
legioz opened this issue Feb 16, 2024 · 0 comments
Open

Incorrect Tz conversion adding extra minutes. #120

legioz opened this issue Feb 16, 2024 · 0 comments

Comments

@legioz
Copy link

legioz commented Feb 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant