blog/manejo-timezones-python/ #2
Replies: 1 comment
-
@soloidx A partir de Python 3.9 viene un módulo first-party llamado >>> from zoneinfo import ZoneInfo
>>> from datetime import datetime, timedelta
>>> # Daylight saving time
>>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles"))
>>> print(dt)
2020-10-31 12:00:00-07:00
>>> dt.tzname()
'PDT'
>>> # Standard time
>>> dt += timedelta(days=7)
>>> print(dt)
2020-11-07 12:00:00-08:00
>>> print(dt.tzname()) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
blog/manejo-timezones-python/
https://blog.python.pe/blog/manejo-timezones-python/
Beta Was this translation helpful? Give feedback.
All reactions