“Python datetime minus datetime” Code-Antworten

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

Python DateTime minus 1 Tag

from datetime import datetime, timedelta
    
d = datetime.today() - timedelta(days=days_to_subtract)
Xenophobic Xenomorph

wie man Daten in Python subtrahieren

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)
MiataTony

Python datetime minus datetime

from datetime import datetime

birthday = datetime(1988, 2, 19, 12, 0, 0)
diff = datetime.now() - birthday
print diff
# 8954 days, 7:03:45.765329
Fantastic Fly

Ähnliche Antworten wie “Python datetime minus datetime”

Fragen ähnlich wie “Python datetime minus datetime”

Weitere verwandte Antworten zu “Python datetime minus datetime” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen