fork(2) download
  1. import datetime
  2.  
  3. d1 = datetime.datetime(2014,7,16,23)
  4. d2 = datetime.datetime.now()
  5.  
  6. diff = d2 - d1
  7.  
  8. days = diff.days
  9. years, days = days // 365, days % 365
  10. months, days = days // 30, days % 30
  11.  
  12. seconds = diff.seconds
  13. hours, seconds = seconds // 3600, seconds % 3600
  14. minutes, seconds = seconds // 60, seconds % 60
  15.  
  16. print("Desde {} passaram {} anos, {} meses, {} dias, {} horas, {} minutos e {} segundos".format(d1, years, months, days, hours, minutes, seconds))
Success #stdin #stdout 0.01s 27984KB
stdin
Standard input is empty
stdout
Desde 2014-07-16 23:00:00 passaram 3 anos, 0 meses, 12 dias, 23 horas, 6 minutos e 52 segundos