Python datetime jetzt minus 3 Stunden
from datetime import datetime, timedelta
d = datetime.today() - timedelta(hours=0, minutes=50)
d.strftime('%H:%M %p')
Fantastic Fly
from datetime import datetime, timedelta
d = datetime.today() - timedelta(hours=0, minutes=50)
d.strftime('%H:%M %p')
from datetime import datetime, timedelta
d = datetime.today() - timedelta(days=days_to_subtract)
from datetime import datetime
def days_between(d1, d2):
d1 = datetime.strptime(d1, "%Y-%m-%d")
d2 = datetime.strptime(d2, "%Y-%m-%d")
return abs((d2 - d1).days)
from datetime import datetime
birthday = datetime(1988, 2, 19, 12, 0, 0)
diff = datetime.now() - birthday
print diff
# 8954 days, 7:03:45.765329