Answers for "subtract a day from datetime python"

0

how to subtract dates in Python

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)
Posted by: Guest on July-18-2021

Code answers related to "subtract a day from datetime python"

Python Answers by Framework

Browse Popular Code Answers by Language