Calendário de Horário de Verão
Veja datas de início e fim do horário de verão por país para o ano atual e próximo.
Deslocamento UTC Inverno
UTC-05:00
Deslocamento UTC Verão
UTC-04:00
2026 — Ano Atual
Início DST
Sun, Mar 8
→ UTC-04:00
Fim DST
Sun, Nov 1
→ UTC-05:00
2027 — Próximo Ano
Início DST
Sun, Mar 14
→ UTC-04:00
Fim DST
Sun, Nov 7
→ UTC-05:00
hora local (mudança de relógio às 2:00)
Perguntas Frequentes
Implementação de Código
from datetime import datetime, timedelta
import pytz # pip install pytz
def get_dst_transitions(tz_name: str, year: int) -> dict:
"""Get DST start and end dates for a timezone in a given year."""
tz = pytz.timezone(tz_name)
transitions = []
# Check each day of the year for offset changes
prev_offset = None
for day in range(365 + (1 if year % 4 == 0 else 0)):
dt = datetime(year, 1, 1) + timedelta(days=day)
localized = tz.localize(dt)
offset = localized.utcoffset()
if prev_offset is not None and offset != prev_offset:
transitions.append({
"date": dt.strftime("%Y-%m-%d"),
"from_offset": str(prev_offset),
"to_offset": str(offset),
"type": "start" if offset > prev_offset else "end",
})
prev_offset = offset
return {"timezone": tz_name, "year": year, "transitions": transitions}
# Example
info = get_dst_transitions("America/New_York", 2024)
for t in info["transitions"]:
print(f"DST {t['type']}: {t['date']} ({t['from_offset']} -> {t['to_offset']})")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.