Skip to content

Instantly share code, notes, and snippets.

@joaodubas
Created May 17, 2010 22:21
Show Gist options
  • Save joaodubas/404310 to your computer and use it in GitHub Desktop.
Save joaodubas/404310 to your computer and use it in GitHub Desktop.
from datetime import datetime
while tempo >= 0:
if minuto > 59:
hora += 1
minuto = 0
if hora > 23:
dia += 1
hora = 0
if dia > dia_limite:
mes += 1
dia = 1
if mes <= 12:
#definir novo dia limite
if mes > 12:
ano += 1
mes = 1
#definir novo dia limite
tempo -= 1
if tempo >= 0:
minuto += 1
datetime.datetime(ano, mes, dia, hora, minuto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment